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_InvalidAmount;
309 case 4: return LDKCreationError_MissingRouteHints;
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_InvalidAmount = NULL;
319 static jfieldID CreationError_LDKCreationError_MissingRouteHints = 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_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
330 CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
331 CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
332 CHECK(CreationError_LDKCreationError_MissingRouteHints != 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_InvalidAmount:
343 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
344 case LDKCreationError_MissingRouteHints:
345 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
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 LDKRecipient LDKRecipient_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 Recipient.ordinal() from rust threw an exception.");
643 case 0: return LDKRecipient_Node;
644 case 1: return LDKRecipient_PhantomNode;
646 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
647 abort(); // Unreachable, but will let the compiler know we don't return here
649 static jclass Recipient_class = NULL;
650 static jfieldID Recipient_LDKRecipient_Node = NULL;
651 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
652 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
653 Recipient_class = (*env)->NewGlobalRef(env, clz);
654 CHECK(Recipient_class != NULL);
655 Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
656 CHECK(Recipient_LDKRecipient_Node != NULL);
657 Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
658 CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
660 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
662 case LDKRecipient_Node:
663 return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
664 case LDKRecipient_PhantomNode:
665 return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
670 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
671 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
672 if (UNLIKELY((*env)->ExceptionCheck(env))) {
673 (*env)->ExceptionDescribe(env);
674 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
677 case 0: return LDKSecp256k1Error_IncorrectSignature;
678 case 1: return LDKSecp256k1Error_InvalidMessage;
679 case 2: return LDKSecp256k1Error_InvalidPublicKey;
680 case 3: return LDKSecp256k1Error_InvalidSignature;
681 case 4: return LDKSecp256k1Error_InvalidSecretKey;
682 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
683 case 6: return LDKSecp256k1Error_InvalidTweak;
684 case 7: return LDKSecp256k1Error_TweakCheckFailed;
685 case 8: return LDKSecp256k1Error_NotEnoughMemory;
687 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
688 abort(); // Unreachable, but will let the compiler know we don't return here
690 static jclass Secp256k1Error_class = NULL;
691 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
692 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
693 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
694 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
695 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
696 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
697 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
698 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
699 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
700 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
701 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
702 CHECK(Secp256k1Error_class != NULL);
703 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
704 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
705 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
706 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
707 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
708 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
709 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
710 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
711 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
712 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
713 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
714 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
715 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
716 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
717 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
718 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
719 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
720 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
722 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
724 case LDKSecp256k1Error_IncorrectSignature:
725 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
726 case LDKSecp256k1Error_InvalidMessage:
727 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
728 case LDKSecp256k1Error_InvalidPublicKey:
729 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
730 case LDKSecp256k1Error_InvalidSignature:
731 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
732 case LDKSecp256k1Error_InvalidSecretKey:
733 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
734 case LDKSecp256k1Error_InvalidRecoveryId:
735 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
736 case LDKSecp256k1Error_InvalidTweak:
737 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
738 case LDKSecp256k1Error_TweakCheckFailed:
739 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
740 case LDKSecp256k1Error_NotEnoughMemory:
741 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
746 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
747 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
748 if (UNLIKELY((*env)->ExceptionCheck(env))) {
749 (*env)->ExceptionDescribe(env);
750 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception.");
753 case 0: return LDKSemanticError_NoPaymentHash;
754 case 1: return LDKSemanticError_MultiplePaymentHashes;
755 case 2: return LDKSemanticError_NoDescription;
756 case 3: return LDKSemanticError_MultipleDescriptions;
757 case 4: return LDKSemanticError_NoPaymentSecret;
758 case 5: return LDKSemanticError_MultiplePaymentSecrets;
759 case 6: return LDKSemanticError_InvalidFeatures;
760 case 7: return LDKSemanticError_InvalidRecoveryId;
761 case 8: return LDKSemanticError_InvalidSignature;
762 case 9: return LDKSemanticError_ImpreciseAmount;
764 (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value.");
765 abort(); // Unreachable, but will let the compiler know we don't return here
767 static jclass SemanticError_class = NULL;
768 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
769 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
770 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
771 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
772 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
773 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
774 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
775 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
776 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
777 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
778 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
779 SemanticError_class = (*env)->NewGlobalRef(env, clz);
780 CHECK(SemanticError_class != NULL);
781 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
782 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
783 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
784 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
785 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
786 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
787 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
788 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
789 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
790 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
791 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
792 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
793 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
794 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
795 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
796 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
797 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
798 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
799 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
800 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
802 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
804 case LDKSemanticError_NoPaymentHash:
805 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
806 case LDKSemanticError_MultiplePaymentHashes:
807 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
808 case LDKSemanticError_NoDescription:
809 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
810 case LDKSemanticError_MultipleDescriptions:
811 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
812 case LDKSemanticError_NoPaymentSecret:
813 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
814 case LDKSemanticError_MultiplePaymentSecrets:
815 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
816 case LDKSemanticError_InvalidFeatures:
817 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
818 case LDKSemanticError_InvalidRecoveryId:
819 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
820 case LDKSemanticError_InvalidSignature:
821 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
822 case LDKSemanticError_ImpreciseAmount:
823 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
828 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
829 jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
830 if (UNLIKELY((*env)->ExceptionCheck(env))) {
831 (*env)->ExceptionDescribe(env);
832 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
835 case 0: return LDKSiPrefix_Milli;
836 case 1: return LDKSiPrefix_Micro;
837 case 2: return LDKSiPrefix_Nano;
838 case 3: return LDKSiPrefix_Pico;
840 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
841 abort(); // Unreachable, but will let the compiler know we don't return here
843 static jclass SiPrefix_class = NULL;
844 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
845 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
846 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
847 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
848 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
849 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
850 CHECK(SiPrefix_class != NULL);
851 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
852 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
853 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
854 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
855 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
856 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
857 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
858 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
860 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
862 case LDKSiPrefix_Milli:
863 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
864 case LDKSiPrefix_Micro:
865 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
866 case LDKSiPrefix_Nano:
867 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
868 case LDKSiPrefix_Pico:
869 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
874 static jclass LDKBech32Error_MissingSeparator_class = NULL;
875 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
876 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
877 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
878 static jclass LDKBech32Error_InvalidLength_class = NULL;
879 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
880 static jclass LDKBech32Error_InvalidChar_class = NULL;
881 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
882 static jclass LDKBech32Error_InvalidData_class = NULL;
883 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
884 static jclass LDKBech32Error_InvalidPadding_class = NULL;
885 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
886 static jclass LDKBech32Error_MixedCase_class = NULL;
887 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
889 LDKBech32Error_MissingSeparator_class =
890 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
891 CHECK(LDKBech32Error_MissingSeparator_class != NULL);
892 LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
893 CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
894 LDKBech32Error_InvalidChecksum_class =
895 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
896 CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
897 LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
898 CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
899 LDKBech32Error_InvalidLength_class =
900 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
901 CHECK(LDKBech32Error_InvalidLength_class != NULL);
902 LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
903 CHECK(LDKBech32Error_InvalidLength_meth != NULL);
904 LDKBech32Error_InvalidChar_class =
905 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
906 CHECK(LDKBech32Error_InvalidChar_class != NULL);
907 LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
908 CHECK(LDKBech32Error_InvalidChar_meth != NULL);
909 LDKBech32Error_InvalidData_class =
910 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
911 CHECK(LDKBech32Error_InvalidData_class != NULL);
912 LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
913 CHECK(LDKBech32Error_InvalidData_meth != NULL);
914 LDKBech32Error_InvalidPadding_class =
915 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
916 CHECK(LDKBech32Error_InvalidPadding_class != NULL);
917 LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
918 CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
919 LDKBech32Error_MixedCase_class =
920 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
921 CHECK(LDKBech32Error_MixedCase_class != NULL);
922 LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
923 CHECK(LDKBech32Error_MixedCase_meth != NULL);
925 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
926 LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1);
928 case LDKBech32Error_MissingSeparator: {
929 return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
931 case LDKBech32Error_InvalidChecksum: {
932 return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
934 case LDKBech32Error_InvalidLength: {
935 return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
937 case LDKBech32Error_InvalidChar: {
938 int32_t invalid_char_conv = obj->invalid_char;
939 return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
941 case LDKBech32Error_InvalidData: {
942 int8_t invalid_data_conv = obj->invalid_data;
943 return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
945 case LDKBech32Error_InvalidPadding: {
946 return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
948 case LDKBech32Error_MixedCase: {
949 return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
954 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
955 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
956 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
959 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) {
960 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
961 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
962 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
963 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
964 CVec_u8Z_free(ret_var);
968 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) {
969 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
970 int64_t ret_conv = TxOut_get_value(thing_conv);
974 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
975 CHECK(owner->result_ok);
976 return *owner->contents.result;
978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
979 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
980 CResult_NoneNoneZ_get_ok(owner_conv);
983 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
984 CHECK(!owner->result_ok);
985 return *owner->contents.err;
987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
988 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
989 CResult_NoneNoneZ_get_err(owner_conv);
992 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
993 CHECK(owner->result_ok);
994 return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
997 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
998 LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
1000 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1001 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1003 ret_ref = (uintptr_t)ret_var.inner;
1004 if (ret_var.is_owned) {
1010 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1011 CHECK(!owner->result_ok);
1012 return DecodeError_clone(&*owner->contents.err);
1014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1015 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
1016 LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
1017 int64_t ret_ref = 0;
1018 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1019 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1021 ret_ref = (uintptr_t)ret_var.inner;
1022 if (ret_var.is_owned) {
1028 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1029 CHECK(owner->result_ok);
1030 return *owner->contents.result;
1032 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1033 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
1034 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1035 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
1039 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
1040 CHECK(!owner->result_ok);
1041 return *owner->contents.err;
1043 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1044 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
1045 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
1049 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1050 CHECK(owner->result_ok);
1051 return *owner->contents.result;
1053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1054 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
1055 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
1056 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
1060 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
1061 CHECK(!owner->result_ok);
1062 return *owner->contents.err;
1064 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1065 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
1066 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
1070 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1071 CHECK(owner->result_ok);
1072 return TxCreationKeys_clone(&*owner->contents.result);
1074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1075 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
1076 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1077 int64_t ret_ref = 0;
1078 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1079 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1080 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1081 ret_ref = (uintptr_t)ret_var.inner;
1082 if (ret_var.is_owned) {
1088 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1089 CHECK(!owner->result_ok);
1090 return DecodeError_clone(&*owner->contents.err);
1092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1093 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
1094 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1095 int64_t ret_ref = 0;
1096 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1097 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1098 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1099 ret_ref = (uintptr_t)ret_var.inner;
1100 if (ret_var.is_owned) {
1106 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1107 CHECK(owner->result_ok);
1108 return ChannelPublicKeys_clone(&*owner->contents.result);
1110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1111 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1112 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1113 int64_t ret_ref = 0;
1114 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1115 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1116 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1117 ret_ref = (uintptr_t)ret_var.inner;
1118 if (ret_var.is_owned) {
1124 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1125 CHECK(!owner->result_ok);
1126 return DecodeError_clone(&*owner->contents.err);
1128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1129 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1130 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1131 int64_t ret_ref = 0;
1132 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1133 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1135 ret_ref = (uintptr_t)ret_var.inner;
1136 if (ret_var.is_owned) {
1142 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1143 CHECK(owner->result_ok);
1144 return TxCreationKeys_clone(&*owner->contents.result);
1146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1147 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1148 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
1149 int64_t ret_ref = 0;
1150 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1151 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1153 ret_ref = (uintptr_t)ret_var.inner;
1154 if (ret_var.is_owned) {
1160 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1161 CHECK(!owner->result_ok);
1162 return *owner->contents.err;
1164 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1165 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1166 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1170 static jclass LDKCOption_u32Z_Some_class = NULL;
1171 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1172 static jclass LDKCOption_u32Z_None_class = NULL;
1173 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1175 LDKCOption_u32Z_Some_class =
1176 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1177 CHECK(LDKCOption_u32Z_Some_class != NULL);
1178 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1179 CHECK(LDKCOption_u32Z_Some_meth != NULL);
1180 LDKCOption_u32Z_None_class =
1181 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1182 CHECK(LDKCOption_u32Z_None_class != NULL);
1183 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1184 CHECK(LDKCOption_u32Z_None_meth != NULL);
1186 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1187 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
1189 case LDKCOption_u32Z_Some: {
1190 int32_t some_conv = obj->some;
1191 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
1193 case LDKCOption_u32Z_None: {
1194 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1199 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1200 CHECK(owner->result_ok);
1201 return HTLCOutputInCommitment_clone(&*owner->contents.result);
1203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1204 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1205 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1206 int64_t ret_ref = 0;
1207 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1208 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1209 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1210 ret_ref = (uintptr_t)ret_var.inner;
1211 if (ret_var.is_owned) {
1217 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1218 CHECK(!owner->result_ok);
1219 return DecodeError_clone(&*owner->contents.err);
1221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1222 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1223 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1224 int64_t ret_ref = 0;
1225 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1226 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1228 ret_ref = (uintptr_t)ret_var.inner;
1229 if (ret_var.is_owned) {
1235 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1236 CHECK(owner->result_ok);
1237 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
1239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1240 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1241 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1242 int64_t ret_ref = 0;
1243 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1244 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1245 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1246 ret_ref = (uintptr_t)ret_var.inner;
1247 if (ret_var.is_owned) {
1253 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1254 CHECK(!owner->result_ok);
1255 return DecodeError_clone(&*owner->contents.err);
1257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1258 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1259 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1260 int64_t ret_ref = 0;
1261 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1262 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1264 ret_ref = (uintptr_t)ret_var.inner;
1265 if (ret_var.is_owned) {
1271 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1272 CHECK(owner->result_ok);
1273 return ChannelTransactionParameters_clone(&*owner->contents.result);
1275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1276 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1277 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1278 int64_t ret_ref = 0;
1279 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1280 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1282 ret_ref = (uintptr_t)ret_var.inner;
1283 if (ret_var.is_owned) {
1289 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1290 CHECK(!owner->result_ok);
1291 return DecodeError_clone(&*owner->contents.err);
1293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1294 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1295 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1296 int64_t ret_ref = 0;
1297 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1298 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1299 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1300 ret_ref = (uintptr_t)ret_var.inner;
1301 if (ret_var.is_owned) {
1307 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1308 CHECK(owner->result_ok);
1309 return HolderCommitmentTransaction_clone(&*owner->contents.result);
1311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1312 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1313 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1314 int64_t ret_ref = 0;
1315 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1316 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1317 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1318 ret_ref = (uintptr_t)ret_var.inner;
1319 if (ret_var.is_owned) {
1325 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1326 CHECK(!owner->result_ok);
1327 return DecodeError_clone(&*owner->contents.err);
1329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1330 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1331 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1332 int64_t ret_ref = 0;
1333 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1334 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1335 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1336 ret_ref = (uintptr_t)ret_var.inner;
1337 if (ret_var.is_owned) {
1343 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1344 CHECK(owner->result_ok);
1345 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
1347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1348 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1349 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1350 int64_t ret_ref = 0;
1351 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1352 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1353 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1354 ret_ref = (uintptr_t)ret_var.inner;
1355 if (ret_var.is_owned) {
1361 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1362 CHECK(!owner->result_ok);
1363 return DecodeError_clone(&*owner->contents.err);
1365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1366 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1367 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1368 int64_t ret_ref = 0;
1369 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1370 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1372 ret_ref = (uintptr_t)ret_var.inner;
1373 if (ret_var.is_owned) {
1379 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1380 CHECK(owner->result_ok);
1381 return &*owner->contents.result;
1383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1384 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1385 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1386 int64_t ret_ref = 0;
1387 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1388 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1389 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1390 ret_ref = (uintptr_t)ret_var.inner & ~1;
1394 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1395 CHECK(!owner->result_ok);
1396 return *owner->contents.err;
1398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1399 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1400 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1403 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1404 CHECK(owner->result_ok);
1405 return CommitmentTransaction_clone(&*owner->contents.result);
1407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1408 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1409 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1410 int64_t ret_ref = 0;
1411 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1412 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1414 ret_ref = (uintptr_t)ret_var.inner;
1415 if (ret_var.is_owned) {
1421 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1422 CHECK(!owner->result_ok);
1423 return DecodeError_clone(&*owner->contents.err);
1425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1426 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1427 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1428 int64_t ret_ref = 0;
1429 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1430 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1431 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1432 ret_ref = (uintptr_t)ret_var.inner;
1433 if (ret_var.is_owned) {
1439 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1440 CHECK(owner->result_ok);
1441 return &*owner->contents.result;
1443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1444 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1445 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1446 int64_t ret_ref = 0;
1447 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1448 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1450 ret_ref = (uintptr_t)ret_var.inner & ~1;
1454 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1455 CHECK(!owner->result_ok);
1456 return *owner->contents.err;
1458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1459 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1460 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1463 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1464 CHECK(owner->result_ok);
1465 return *owner->contents.result;
1467 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1468 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1469 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1470 jobjectArray ret_arr = NULL;
1471 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1473 for (size_t i = 0; i < ret_var.datalen; i++) {
1474 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1475 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1476 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1482 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1483 CHECK(!owner->result_ok);
1484 return *owner->contents.err;
1486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1487 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1488 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1491 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1492 CHECK(owner->result_ok);
1493 return ShutdownScript_clone(&*owner->contents.result);
1495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1496 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1497 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1498 int64_t ret_ref = 0;
1499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1502 ret_ref = (uintptr_t)ret_var.inner;
1503 if (ret_var.is_owned) {
1509 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1510 CHECK(!owner->result_ok);
1511 return DecodeError_clone(&*owner->contents.err);
1513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1514 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1515 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1516 int64_t ret_ref = 0;
1517 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1518 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1520 ret_ref = (uintptr_t)ret_var.inner;
1521 if (ret_var.is_owned) {
1527 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1528 CHECK(owner->result_ok);
1529 return ShutdownScript_clone(&*owner->contents.result);
1531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1532 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1533 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1534 int64_t ret_ref = 0;
1535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1538 ret_ref = (uintptr_t)ret_var.inner;
1539 if (ret_var.is_owned) {
1545 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1546 CHECK(!owner->result_ok);
1547 return InvalidShutdownScript_clone(&*owner->contents.err);
1549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1550 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1551 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1552 int64_t ret_ref = 0;
1553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1556 ret_ref = (uintptr_t)ret_var.inner;
1557 if (ret_var.is_owned) {
1563 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1564 CHECK(owner->result_ok);
1565 return *owner->contents.result;
1567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1568 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1569 CResult_NoneErrorZ_get_ok(owner_conv);
1572 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1573 CHECK(!owner->result_ok);
1574 return *owner->contents.err;
1576 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1577 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1578 jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
1582 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1583 CHECK(owner->result_ok);
1584 return RouteHop_clone(&*owner->contents.result);
1586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1587 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1588 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1589 int64_t ret_ref = 0;
1590 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1591 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1593 ret_ref = (uintptr_t)ret_var.inner;
1594 if (ret_var.is_owned) {
1600 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1601 CHECK(!owner->result_ok);
1602 return DecodeError_clone(&*owner->contents.err);
1604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1605 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1606 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1607 int64_t ret_ref = 0;
1608 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1609 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1610 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1611 ret_ref = (uintptr_t)ret_var.inner;
1612 if (ret_var.is_owned) {
1618 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1619 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1620 for (size_t i = 0; i < ret.datalen; i++) {
1621 ret.data[i] = RouteHop_clone(&orig->data[i]);
1625 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1626 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1627 for (size_t i = 0; i < ret.datalen; i++) {
1628 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1632 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1633 CHECK(owner->result_ok);
1634 return Route_clone(&*owner->contents.result);
1636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1637 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1638 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1639 int64_t ret_ref = 0;
1640 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1641 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1643 ret_ref = (uintptr_t)ret_var.inner;
1644 if (ret_var.is_owned) {
1650 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1651 CHECK(!owner->result_ok);
1652 return DecodeError_clone(&*owner->contents.err);
1654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1655 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1656 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1657 int64_t ret_ref = 0;
1658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1661 ret_ref = (uintptr_t)ret_var.inner;
1662 if (ret_var.is_owned) {
1668 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1669 CHECK(owner->result_ok);
1670 return RouteParameters_clone(&*owner->contents.result);
1672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1673 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1674 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1675 int64_t ret_ref = 0;
1676 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1677 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1678 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1679 ret_ref = (uintptr_t)ret_var.inner;
1680 if (ret_var.is_owned) {
1686 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1687 CHECK(!owner->result_ok);
1688 return DecodeError_clone(&*owner->contents.err);
1690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1691 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1692 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1693 int64_t ret_ref = 0;
1694 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1695 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1696 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1697 ret_ref = (uintptr_t)ret_var.inner;
1698 if (ret_var.is_owned) {
1704 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1705 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1706 for (size_t i = 0; i < ret.datalen; i++) {
1707 ret.data[i] = RouteHint_clone(&orig->data[i]);
1711 static jclass LDKCOption_u64Z_Some_class = NULL;
1712 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1713 static jclass LDKCOption_u64Z_None_class = NULL;
1714 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1716 LDKCOption_u64Z_Some_class =
1717 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1718 CHECK(LDKCOption_u64Z_Some_class != NULL);
1719 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1720 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1721 LDKCOption_u64Z_None_class =
1722 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1723 CHECK(LDKCOption_u64Z_None_class != NULL);
1724 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1725 CHECK(LDKCOption_u64Z_None_meth != NULL);
1727 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1728 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1730 case LDKCOption_u64Z_Some: {
1731 int64_t some_conv = obj->some;
1732 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1734 case LDKCOption_u64Z_None: {
1735 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1740 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1741 CHECK(owner->result_ok);
1742 return PaymentParameters_clone(&*owner->contents.result);
1744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1745 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1746 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1747 int64_t ret_ref = 0;
1748 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1749 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1750 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1751 ret_ref = (uintptr_t)ret_var.inner;
1752 if (ret_var.is_owned) {
1758 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1759 CHECK(!owner->result_ok);
1760 return DecodeError_clone(&*owner->contents.err);
1762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1763 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1764 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1765 int64_t ret_ref = 0;
1766 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1767 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1769 ret_ref = (uintptr_t)ret_var.inner;
1770 if (ret_var.is_owned) {
1776 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1777 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1778 for (size_t i = 0; i < ret.datalen; i++) {
1779 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1783 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1784 CHECK(owner->result_ok);
1785 return RouteHint_clone(&*owner->contents.result);
1787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1788 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1789 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1790 int64_t ret_ref = 0;
1791 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1792 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1794 ret_ref = (uintptr_t)ret_var.inner;
1795 if (ret_var.is_owned) {
1801 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1802 CHECK(!owner->result_ok);
1803 return DecodeError_clone(&*owner->contents.err);
1805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1806 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1807 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1808 int64_t ret_ref = 0;
1809 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1810 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1811 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1812 ret_ref = (uintptr_t)ret_var.inner;
1813 if (ret_var.is_owned) {
1819 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1820 CHECK(owner->result_ok);
1821 return RouteHintHop_clone(&*owner->contents.result);
1823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1824 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1825 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1826 int64_t ret_ref = 0;
1827 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1828 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1830 ret_ref = (uintptr_t)ret_var.inner;
1831 if (ret_var.is_owned) {
1837 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1838 CHECK(!owner->result_ok);
1839 return DecodeError_clone(&*owner->contents.err);
1841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1842 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1843 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1844 int64_t ret_ref = 0;
1845 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1846 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1848 ret_ref = (uintptr_t)ret_var.inner;
1849 if (ret_var.is_owned) {
1855 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1856 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1857 for (size_t i = 0; i < ret.datalen; i++) {
1858 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1862 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1863 CHECK(owner->result_ok);
1864 return Route_clone(&*owner->contents.result);
1866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1867 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1868 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1869 int64_t ret_ref = 0;
1870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1873 ret_ref = (uintptr_t)ret_var.inner;
1874 if (ret_var.is_owned) {
1880 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1881 CHECK(!owner->result_ok);
1882 return LightningError_clone(&*owner->contents.err);
1884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1885 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1886 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1887 int64_t ret_ref = 0;
1888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1891 ret_ref = (uintptr_t)ret_var.inner;
1892 if (ret_var.is_owned) {
1898 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1899 CHECK(owner->result_ok);
1900 return TxOut_clone(&*owner->contents.result);
1902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1903 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1904 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1905 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
1906 return (int64_t)ret_ref;
1909 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1910 CHECK(!owner->result_ok);
1911 return AccessError_clone(&*owner->contents.err);
1913 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1914 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1915 jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
1919 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
1923 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1924 int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1928 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
1932 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1933 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1934 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1935 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1939 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1940 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1941 for (size_t i = 0; i < ret.datalen; i++) {
1942 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1946 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
1947 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1948 for (size_t i = 0; i < ret.datalen; i++) {
1949 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1953 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1954 CHECK(owner->result_ok);
1955 return *owner->contents.result;
1957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1958 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1959 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
1962 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1963 CHECK(!owner->result_ok);
1964 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
1966 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1967 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1968 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
1972 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1973 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1974 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1975 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1976 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
1977 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
1978 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
1979 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
1980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1981 LDKMonitorEvent_HTLCEvent_class =
1982 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
1983 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1984 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1985 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1986 LDKMonitorEvent_CommitmentTxConfirmed_class =
1987 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
1988 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1989 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1990 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1991 LDKMonitorEvent_UpdateCompleted_class =
1992 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
1993 CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
1994 LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
1995 CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
1996 LDKMonitorEvent_UpdateFailed_class =
1997 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
1998 CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
1999 LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
2000 CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
2002 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2003 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
2005 case LDKMonitorEvent_HTLCEvent: {
2006 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2007 int64_t htlc_event_ref = 0;
2008 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2009 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2010 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2011 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
2012 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
2014 case LDKMonitorEvent_CommitmentTxConfirmed: {
2015 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2016 int64_t commitment_tx_confirmed_ref = 0;
2017 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2018 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2019 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2020 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
2021 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
2023 case LDKMonitorEvent_UpdateCompleted: {
2024 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
2025 int64_t funding_txo_ref = 0;
2026 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2027 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2028 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2029 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
2030 int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
2031 return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, monitor_update_id_conv);
2033 case LDKMonitorEvent_UpdateFailed: {
2034 LDKOutPoint update_failed_var = obj->update_failed;
2035 int64_t update_failed_ref = 0;
2036 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2037 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2038 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2039 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
2040 return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
2045 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2046 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2047 for (size_t i = 0; i < ret.datalen; i++) {
2048 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2052 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
2053 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
2054 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
2055 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
2056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
2057 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
2058 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
2059 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
2060 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
2061 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
2062 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
2063 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
2064 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
2065 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
2066 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
2068 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2069 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
2071 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
2072 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
2073 *some_conv = obj->some;
2074 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
2075 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((int64_t)some_conv));
2077 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
2078 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
2083 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
2084 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
2085 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
2086 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
2087 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
2088 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
2089 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
2090 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
2091 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
2092 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
2093 static jclass LDKClosureReason_ProcessingError_class = NULL;
2094 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
2095 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
2096 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
2097 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
2098 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
2099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
2100 LDKClosureReason_CounterpartyForceClosed_class =
2101 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
2102 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
2103 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
2104 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
2105 LDKClosureReason_HolderForceClosed_class =
2106 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
2107 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
2108 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
2109 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
2110 LDKClosureReason_CooperativeClosure_class =
2111 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
2112 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
2113 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
2114 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
2115 LDKClosureReason_CommitmentTxConfirmed_class =
2116 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
2117 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
2118 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
2119 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
2120 LDKClosureReason_FundingTimedOut_class =
2121 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
2122 CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
2123 LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
2124 CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
2125 LDKClosureReason_ProcessingError_class =
2126 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
2127 CHECK(LDKClosureReason_ProcessingError_class != NULL);
2128 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
2129 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
2130 LDKClosureReason_DisconnectedPeer_class =
2131 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
2132 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
2133 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
2134 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
2135 LDKClosureReason_OutdatedChannelManager_class =
2136 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
2137 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
2138 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
2139 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
2141 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2142 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
2144 case LDKClosureReason_CounterpartyForceClosed: {
2145 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
2146 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
2147 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
2149 case LDKClosureReason_HolderForceClosed: {
2150 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
2152 case LDKClosureReason_CooperativeClosure: {
2153 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
2155 case LDKClosureReason_CommitmentTxConfirmed: {
2156 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
2158 case LDKClosureReason_FundingTimedOut: {
2159 return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
2161 case LDKClosureReason_ProcessingError: {
2162 LDKStr err_str = obj->processing_error.err;
2163 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2164 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
2166 case LDKClosureReason_DisconnectedPeer: {
2167 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
2169 case LDKClosureReason_OutdatedChannelManager: {
2170 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
2175 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
2176 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
2177 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
2178 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
2179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
2180 LDKCOption_ClosureReasonZ_Some_class =
2181 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
2182 CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
2183 LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
2184 CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
2185 LDKCOption_ClosureReasonZ_None_class =
2186 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
2187 CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
2188 LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
2189 CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
2191 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2192 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
2194 case LDKCOption_ClosureReasonZ_Some: {
2195 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2196 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
2198 case LDKCOption_ClosureReasonZ_None: {
2199 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
2204 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2205 CHECK(owner->result_ok);
2206 return COption_ClosureReasonZ_clone(&*owner->contents.result);
2208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2209 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2210 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2211 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2212 int64_t ret_ref = (uintptr_t)ret_copy;
2216 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2217 CHECK(!owner->result_ok);
2218 return DecodeError_clone(&*owner->contents.err);
2220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2221 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2222 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2223 int64_t ret_ref = 0;
2224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2227 ret_ref = (uintptr_t)ret_var.inner;
2228 if (ret_var.is_owned) {
2234 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2235 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2236 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
2237 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
2238 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2239 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2241 LDKNetworkUpdate_ChannelUpdateMessage_class =
2242 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2243 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2244 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2245 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2246 LDKNetworkUpdate_ChannelClosed_class =
2247 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed"));
2248 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
2249 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
2250 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
2251 LDKNetworkUpdate_NodeFailure_class =
2252 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2253 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2254 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2255 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2257 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2258 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
2260 case LDKNetworkUpdate_ChannelUpdateMessage: {
2261 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2262 int64_t msg_ref = 0;
2263 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2264 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2265 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2266 msg_ref = (uintptr_t)msg_var.inner & ~1;
2267 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2269 case LDKNetworkUpdate_ChannelClosed: {
2270 int64_t short_channel_id_conv = obj->channel_closed.short_channel_id;
2271 jboolean is_permanent_conv = obj->channel_closed.is_permanent;
2272 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, short_channel_id_conv, is_permanent_conv);
2274 case LDKNetworkUpdate_NodeFailure: {
2275 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2276 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2277 jboolean is_permanent_conv = obj->node_failure.is_permanent;
2278 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
2283 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2284 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2285 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2286 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2288 LDKCOption_NetworkUpdateZ_Some_class =
2289 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2290 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2291 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2292 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2293 LDKCOption_NetworkUpdateZ_None_class =
2294 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2295 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2296 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2297 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2299 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2300 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
2302 case LDKCOption_NetworkUpdateZ_Some: {
2303 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2304 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2306 case LDKCOption_NetworkUpdateZ_None: {
2307 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2312 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2313 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2314 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2315 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2316 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2317 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2319 LDKSpendableOutputDescriptor_StaticOutput_class =
2320 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2321 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2322 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2323 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2324 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2325 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2326 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2327 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2328 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2329 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2330 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2331 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2332 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2333 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2335 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2336 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
2338 case LDKSpendableOutputDescriptor_StaticOutput: {
2339 LDKOutPoint outpoint_var = obj->static_output.outpoint;
2340 int64_t outpoint_ref = 0;
2341 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2342 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2343 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2344 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
2345 int64_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
2346 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (int64_t)output_ref);
2348 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2349 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2350 int64_t delayed_payment_output_ref = 0;
2351 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2352 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2353 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2354 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
2355 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2357 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2358 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2359 int64_t static_payment_output_ref = 0;
2360 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2361 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2362 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2363 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
2364 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2369 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2370 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2371 for (size_t i = 0; i < ret.datalen; i++) {
2372 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2376 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
2377 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
2378 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
2379 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
2380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
2381 LDKPaymentPurpose_InvoicePayment_class =
2382 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
2383 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
2384 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
2385 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
2386 LDKPaymentPurpose_SpontaneousPayment_class =
2387 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
2388 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
2389 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
2390 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
2392 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2393 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
2395 case LDKPaymentPurpose_InvoicePayment: {
2396 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2397 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
2398 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
2399 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
2400 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
2402 case LDKPaymentPurpose_SpontaneousPayment: {
2403 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
2404 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
2405 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
2410 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2411 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2412 static jclass LDKEvent_PaymentReceived_class = NULL;
2413 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2414 static jclass LDKEvent_PaymentSent_class = NULL;
2415 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2416 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2417 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2418 static jclass LDKEvent_PaymentFailed_class = NULL;
2419 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2420 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2421 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2422 static jclass LDKEvent_SpendableOutputs_class = NULL;
2423 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2424 static jclass LDKEvent_PaymentForwarded_class = NULL;
2425 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2426 static jclass LDKEvent_ChannelClosed_class = NULL;
2427 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2428 static jclass LDKEvent_DiscardFunding_class = NULL;
2429 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2430 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2431 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2432 static jclass LDKEvent_OpenChannelRequest_class = NULL;
2433 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
2434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2435 LDKEvent_FundingGenerationReady_class =
2436 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2437 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2438 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
2439 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2440 LDKEvent_PaymentReceived_class =
2441 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2442 CHECK(LDKEvent_PaymentReceived_class != NULL);
2443 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2444 CHECK(LDKEvent_PaymentReceived_meth != NULL);
2445 LDKEvent_PaymentSent_class =
2446 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2447 CHECK(LDKEvent_PaymentSent_class != NULL);
2448 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2449 CHECK(LDKEvent_PaymentSent_meth != NULL);
2450 LDKEvent_PaymentPathFailed_class =
2451 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2452 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2453 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2454 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2455 LDKEvent_PaymentFailed_class =
2456 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2457 CHECK(LDKEvent_PaymentFailed_class != NULL);
2458 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2459 CHECK(LDKEvent_PaymentFailed_meth != NULL);
2460 LDKEvent_PendingHTLCsForwardable_class =
2461 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2462 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2463 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2464 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2465 LDKEvent_SpendableOutputs_class =
2466 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2467 CHECK(LDKEvent_SpendableOutputs_class != NULL);
2468 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2469 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2470 LDKEvent_PaymentForwarded_class =
2471 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2472 CHECK(LDKEvent_PaymentForwarded_class != NULL);
2473 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
2474 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2475 LDKEvent_ChannelClosed_class =
2476 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2477 CHECK(LDKEvent_ChannelClosed_class != NULL);
2478 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2479 CHECK(LDKEvent_ChannelClosed_meth != NULL);
2480 LDKEvent_DiscardFunding_class =
2481 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2482 CHECK(LDKEvent_DiscardFunding_class != NULL);
2483 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2484 CHECK(LDKEvent_DiscardFunding_meth != NULL);
2485 LDKEvent_PaymentPathSuccessful_class =
2486 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2487 CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2488 LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2489 CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2490 LDKEvent_OpenChannelRequest_class =
2491 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
2492 CHECK(LDKEvent_OpenChannelRequest_class != NULL);
2493 LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJJ)V");
2494 CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
2496 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2497 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2499 case LDKEvent_FundingGenerationReady: {
2500 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2501 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2502 int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
2503 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2504 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2505 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2506 int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
2507 return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, channel_value_satoshis_conv, output_script_arr, user_channel_id_conv);
2509 case LDKEvent_PaymentReceived: {
2510 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2511 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2512 int64_t amt_conv = obj->payment_received.amt;
2513 int64_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
2514 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, amt_conv, purpose_ref);
2516 case LDKEvent_PaymentSent: {
2517 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2518 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2519 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2520 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2521 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2522 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2523 int64_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
2524 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2526 case LDKEvent_PaymentPathFailed: {
2527 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2528 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2529 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2530 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2531 jboolean rejected_by_dest_conv = obj->payment_path_failed.rejected_by_dest;
2532 int64_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
2533 jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
2534 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2535 int64_tArray path_arr = NULL;
2536 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2537 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2538 for (size_t k = 0; k < path_var.datalen; k++) {
2539 LDKRouteHop path_conv_10_var = path_var.data[k];
2540 int64_t path_conv_10_ref = 0;
2541 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2542 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2543 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2544 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2545 path_arr_ptr[k] = path_conv_10_ref;
2547 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2548 int64_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
2549 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2550 int64_t retry_ref = 0;
2551 if ((uintptr_t)retry_var.inner > 4096) {
2552 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2553 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2554 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2555 retry_ref = (uintptr_t)retry_var.inner & ~1;
2557 return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, rejected_by_dest_conv, network_update_ref, all_paths_failed_conv, path_arr, short_channel_id_ref, retry_ref);
2559 case LDKEvent_PaymentFailed: {
2560 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2561 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2562 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2563 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2564 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2566 case LDKEvent_PendingHTLCsForwardable: {
2567 int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
2568 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
2570 case LDKEvent_SpendableOutputs: {
2571 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2572 int64_tArray outputs_arr = NULL;
2573 outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2574 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2575 for (size_t b = 0; b < outputs_var.datalen; b++) {
2576 int64_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
2577 outputs_arr_ptr[b] = outputs_conv_27_ref;
2579 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2580 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2582 case LDKEvent_PaymentForwarded: {
2583 int64_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
2584 jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2585 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, claim_from_onchain_tx_conv);
2587 case LDKEvent_ChannelClosed: {
2588 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2589 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2590 int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
2591 int64_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
2592 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, user_channel_id_conv, reason_ref);
2594 case LDKEvent_DiscardFunding: {
2595 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2596 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2597 LDKTransaction transaction_var = obj->discard_funding.transaction;
2598 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2599 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2600 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2602 case LDKEvent_PaymentPathSuccessful: {
2603 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2604 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2605 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2606 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2607 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2608 int64_tArray path_arr = NULL;
2609 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2610 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2611 for (size_t k = 0; k < path_var.datalen; k++) {
2612 LDKRouteHop path_conv_10_var = path_var.data[k];
2613 int64_t path_conv_10_ref = 0;
2614 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2615 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2616 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2617 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2618 path_arr_ptr[k] = path_conv_10_ref;
2620 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2621 return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2623 case LDKEvent_OpenChannelRequest: {
2624 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2625 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
2626 int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2627 (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
2628 int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2629 int64_t push_msat_conv = obj->open_channel_request.push_msat;
2630 LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2631 int64_t channel_type_ref = 0;
2632 CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2633 CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2634 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2635 channel_type_ref = (uintptr_t)channel_type_var.inner & ~1;
2636 return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref);
2641 static jclass LDKCOption_EventZ_Some_class = NULL;
2642 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2643 static jclass LDKCOption_EventZ_None_class = NULL;
2644 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2646 LDKCOption_EventZ_Some_class =
2647 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2648 CHECK(LDKCOption_EventZ_Some_class != NULL);
2649 LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2650 CHECK(LDKCOption_EventZ_Some_meth != NULL);
2651 LDKCOption_EventZ_None_class =
2652 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2653 CHECK(LDKCOption_EventZ_None_class != NULL);
2654 LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2655 CHECK(LDKCOption_EventZ_None_meth != NULL);
2657 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2658 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2660 case LDKCOption_EventZ_Some: {
2661 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2662 return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2664 case LDKCOption_EventZ_None: {
2665 return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2670 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2671 CHECK(owner->result_ok);
2672 return COption_EventZ_clone(&*owner->contents.result);
2674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2675 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2676 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2677 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2678 int64_t ret_ref = (uintptr_t)ret_copy;
2682 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2683 CHECK(!owner->result_ok);
2684 return DecodeError_clone(&*owner->contents.err);
2686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2687 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2688 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2689 int64_t ret_ref = 0;
2690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2693 ret_ref = (uintptr_t)ret_var.inner;
2694 if (ret_var.is_owned) {
2700 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2701 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2702 static jclass LDKErrorAction_IgnoreError_class = NULL;
2703 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2704 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2705 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2706 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2707 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2708 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2709 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2710 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
2711 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
2712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2713 LDKErrorAction_DisconnectPeer_class =
2714 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2715 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2716 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2717 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2718 LDKErrorAction_IgnoreError_class =
2719 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2720 CHECK(LDKErrorAction_IgnoreError_class != NULL);
2721 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2722 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2723 LDKErrorAction_IgnoreAndLog_class =
2724 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2725 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2726 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2727 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2728 LDKErrorAction_IgnoreDuplicateGossip_class =
2729 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2730 CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2731 LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2732 CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2733 LDKErrorAction_SendErrorMessage_class =
2734 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2735 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2736 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2737 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2738 LDKErrorAction_SendWarningMessage_class =
2739 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
2740 CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
2741 LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
2742 CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
2744 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2745 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2747 case LDKErrorAction_DisconnectPeer: {
2748 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2749 int64_t msg_ref = 0;
2750 if ((uintptr_t)msg_var.inner > 4096) {
2751 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2752 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2753 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2754 msg_ref = (uintptr_t)msg_var.inner & ~1;
2756 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2758 case LDKErrorAction_IgnoreError: {
2759 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2761 case LDKErrorAction_IgnoreAndLog: {
2762 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2763 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2765 case LDKErrorAction_IgnoreDuplicateGossip: {
2766 return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2768 case LDKErrorAction_SendErrorMessage: {
2769 LDKErrorMessage msg_var = obj->send_error_message.msg;
2770 int64_t msg_ref = 0;
2771 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2772 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2773 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2774 msg_ref = (uintptr_t)msg_var.inner & ~1;
2775 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2777 case LDKErrorAction_SendWarningMessage: {
2778 LDKWarningMessage msg_var = obj->send_warning_message.msg;
2779 int64_t msg_ref = 0;
2780 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2781 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2782 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2783 msg_ref = (uintptr_t)msg_var.inner & ~1;
2784 jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
2785 return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
2790 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2791 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2792 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2793 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2794 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2795 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2796 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2797 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2798 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
2799 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
2800 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2801 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2802 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2803 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2804 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2805 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2806 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2807 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2808 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2809 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2810 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2811 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2812 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2813 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2814 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2815 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2816 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2817 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2818 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2819 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2820 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2821 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2822 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2823 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2824 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2825 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2826 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2827 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2828 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
2829 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
2830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2831 LDKMessageSendEvent_SendAcceptChannel_class =
2832 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2833 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2834 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2835 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2836 LDKMessageSendEvent_SendOpenChannel_class =
2837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2838 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2839 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2840 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2841 LDKMessageSendEvent_SendFundingCreated_class =
2842 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2843 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2844 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2845 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2846 LDKMessageSendEvent_SendFundingSigned_class =
2847 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2848 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2849 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2850 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2851 LDKMessageSendEvent_SendFundingLocked_class =
2852 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked"));
2853 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
2854 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
2855 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
2856 LDKMessageSendEvent_SendAnnouncementSignatures_class =
2857 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2858 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2859 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2860 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2861 LDKMessageSendEvent_UpdateHTLCs_class =
2862 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2863 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2864 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2865 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2866 LDKMessageSendEvent_SendRevokeAndACK_class =
2867 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2868 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2869 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2870 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2871 LDKMessageSendEvent_SendClosingSigned_class =
2872 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2873 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2874 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2875 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2876 LDKMessageSendEvent_SendShutdown_class =
2877 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2878 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2879 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2880 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2881 LDKMessageSendEvent_SendChannelReestablish_class =
2882 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2883 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2884 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2885 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2886 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2887 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2888 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2889 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2890 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2891 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2892 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2893 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2894 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2895 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2896 LDKMessageSendEvent_BroadcastChannelUpdate_class =
2897 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2898 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2899 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2900 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2901 LDKMessageSendEvent_SendChannelUpdate_class =
2902 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2903 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2904 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2905 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2906 LDKMessageSendEvent_HandleError_class =
2907 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2908 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2909 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2910 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2911 LDKMessageSendEvent_SendChannelRangeQuery_class =
2912 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2913 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2914 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2915 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2916 LDKMessageSendEvent_SendShortIdsQuery_class =
2917 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2918 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2919 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2920 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2921 LDKMessageSendEvent_SendReplyChannelRange_class =
2922 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2923 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2924 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2925 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2926 LDKMessageSendEvent_SendGossipTimestampFilter_class =
2927 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
2928 CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
2929 LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
2930 CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
2932 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2933 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2935 case LDKMessageSendEvent_SendAcceptChannel: {
2936 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2937 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2938 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2939 int64_t msg_ref = 0;
2940 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2941 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2942 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2943 msg_ref = (uintptr_t)msg_var.inner & ~1;
2944 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2946 case LDKMessageSendEvent_SendOpenChannel: {
2947 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2948 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2949 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2950 int64_t msg_ref = 0;
2951 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2952 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2953 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2954 msg_ref = (uintptr_t)msg_var.inner & ~1;
2955 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2957 case LDKMessageSendEvent_SendFundingCreated: {
2958 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2959 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2960 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2961 int64_t msg_ref = 0;
2962 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2963 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2964 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2965 msg_ref = (uintptr_t)msg_var.inner & ~1;
2966 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2968 case LDKMessageSendEvent_SendFundingSigned: {
2969 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2970 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2971 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2972 int64_t msg_ref = 0;
2973 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2974 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2975 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2976 msg_ref = (uintptr_t)msg_var.inner & ~1;
2977 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2979 case LDKMessageSendEvent_SendFundingLocked: {
2980 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2981 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
2982 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2983 int64_t msg_ref = 0;
2984 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2985 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2986 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2987 msg_ref = (uintptr_t)msg_var.inner & ~1;
2988 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
2990 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2991 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2992 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2993 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2994 int64_t msg_ref = 0;
2995 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2996 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2997 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2998 msg_ref = (uintptr_t)msg_var.inner & ~1;
2999 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
3001 case LDKMessageSendEvent_UpdateHTLCs: {
3002 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3003 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
3004 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
3005 int64_t updates_ref = 0;
3006 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3007 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3008 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
3009 updates_ref = (uintptr_t)updates_var.inner & ~1;
3010 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
3012 case LDKMessageSendEvent_SendRevokeAndACK: {
3013 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3014 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
3015 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
3016 int64_t msg_ref = 0;
3017 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3018 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3019 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3020 msg_ref = (uintptr_t)msg_var.inner & ~1;
3021 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
3023 case LDKMessageSendEvent_SendClosingSigned: {
3024 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3025 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
3026 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
3027 int64_t msg_ref = 0;
3028 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3029 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3030 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3031 msg_ref = (uintptr_t)msg_var.inner & ~1;
3032 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
3034 case LDKMessageSendEvent_SendShutdown: {
3035 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3036 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
3037 LDKShutdown msg_var = obj->send_shutdown.msg;
3038 int64_t msg_ref = 0;
3039 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3040 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3041 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3042 msg_ref = (uintptr_t)msg_var.inner & ~1;
3043 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
3045 case LDKMessageSendEvent_SendChannelReestablish: {
3046 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3047 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
3048 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
3049 int64_t msg_ref = 0;
3050 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3051 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3052 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3053 msg_ref = (uintptr_t)msg_var.inner & ~1;
3054 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
3056 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
3057 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
3058 int64_t msg_ref = 0;
3059 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3060 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3061 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3062 msg_ref = (uintptr_t)msg_var.inner & ~1;
3063 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
3064 int64_t update_msg_ref = 0;
3065 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3066 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3067 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
3068 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
3069 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
3071 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
3072 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
3073 int64_t msg_ref = 0;
3074 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3075 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3076 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3077 msg_ref = (uintptr_t)msg_var.inner & ~1;
3078 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
3080 case LDKMessageSendEvent_BroadcastChannelUpdate: {
3081 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
3082 int64_t msg_ref = 0;
3083 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3084 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3085 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3086 msg_ref = (uintptr_t)msg_var.inner & ~1;
3087 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
3089 case LDKMessageSendEvent_SendChannelUpdate: {
3090 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3091 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
3092 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
3093 int64_t msg_ref = 0;
3094 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3095 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3096 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3097 msg_ref = (uintptr_t)msg_var.inner & ~1;
3098 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
3100 case LDKMessageSendEvent_HandleError: {
3101 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3102 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
3103 int64_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
3104 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
3106 case LDKMessageSendEvent_SendChannelRangeQuery: {
3107 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3108 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
3109 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3110 int64_t msg_ref = 0;
3111 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3112 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3113 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3114 msg_ref = (uintptr_t)msg_var.inner & ~1;
3115 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
3117 case LDKMessageSendEvent_SendShortIdsQuery: {
3118 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3119 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
3120 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3121 int64_t msg_ref = 0;
3122 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3123 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3124 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3125 msg_ref = (uintptr_t)msg_var.inner & ~1;
3126 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
3128 case LDKMessageSendEvent_SendReplyChannelRange: {
3129 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3130 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
3131 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3132 int64_t msg_ref = 0;
3133 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3134 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3135 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3136 msg_ref = (uintptr_t)msg_var.inner & ~1;
3137 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
3139 case LDKMessageSendEvent_SendGossipTimestampFilter: {
3140 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3141 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
3142 LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
3143 int64_t msg_ref = 0;
3144 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3145 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3146 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3147 msg_ref = (uintptr_t)msg_var.inner & ~1;
3148 return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
3153 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3154 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3155 for (size_t i = 0; i < ret.datalen; i++) {
3156 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3160 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3161 CHECK(owner->result_ok);
3162 return FixedPenaltyScorer_clone(&*owner->contents.result);
3164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3165 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3166 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3167 int64_t ret_ref = 0;
3168 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3169 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3170 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3171 ret_ref = (uintptr_t)ret_var.inner;
3172 if (ret_var.is_owned) {
3178 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3179 CHECK(!owner->result_ok);
3180 return DecodeError_clone(&*owner->contents.err);
3182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3183 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3184 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3185 int64_t ret_ref = 0;
3186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3189 ret_ref = (uintptr_t)ret_var.inner;
3190 if (ret_var.is_owned) {
3196 static inline struct LDKScoringParameters CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3197 CHECK(owner->result_ok);
3198 return ScoringParameters_clone(&*owner->contents.result);
3200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3201 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3202 LDKScoringParameters ret_var = CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv);
3203 int64_t ret_ref = 0;
3204 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3205 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3207 ret_ref = (uintptr_t)ret_var.inner;
3208 if (ret_var.is_owned) {
3214 static inline struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3215 CHECK(!owner->result_ok);
3216 return DecodeError_clone(&*owner->contents.err);
3218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3219 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3220 LDKDecodeError ret_var = CResult_ScoringParametersDecodeErrorZ_get_err(owner_conv);
3221 int64_t ret_ref = 0;
3222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3225 ret_ref = (uintptr_t)ret_var.inner;
3226 if (ret_var.is_owned) {
3232 static inline struct LDKScorer *CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
3233 CHECK(owner->result_ok);
3234 return &*owner->contents.result;
3236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3237 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
3238 LDKScorer ret_var = *CResult_ScorerDecodeErrorZ_get_ok(owner_conv);
3239 int64_t ret_ref = 0;
3240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3243 ret_ref = (uintptr_t)ret_var.inner & ~1;
3247 static inline struct LDKDecodeError CResult_ScorerDecodeErrorZ_get_err(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
3248 CHECK(!owner->result_ok);
3249 return DecodeError_clone(&*owner->contents.err);
3251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3252 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
3253 LDKDecodeError ret_var = CResult_ScorerDecodeErrorZ_get_err(owner_conv);
3254 int64_t ret_ref = 0;
3255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3258 ret_ref = (uintptr_t)ret_var.inner;
3259 if (ret_var.is_owned) {
3265 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3266 CHECK(owner->result_ok);
3267 return &*owner->contents.result;
3269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3270 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3271 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3272 int64_t ret_ref = 0;
3273 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3274 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3276 ret_ref = (uintptr_t)ret_var.inner & ~1;
3280 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3281 CHECK(!owner->result_ok);
3282 return DecodeError_clone(&*owner->contents.err);
3284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3285 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3286 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3287 int64_t ret_ref = 0;
3288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3291 ret_ref = (uintptr_t)ret_var.inner;
3292 if (ret_var.is_owned) {
3298 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3299 CHECK(owner->result_ok);
3300 return InitFeatures_clone(&*owner->contents.result);
3302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3303 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3304 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3305 int64_t ret_ref = 0;
3306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3309 ret_ref = (uintptr_t)ret_var.inner;
3310 if (ret_var.is_owned) {
3316 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3317 CHECK(!owner->result_ok);
3318 return DecodeError_clone(&*owner->contents.err);
3320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3321 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3322 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3323 int64_t ret_ref = 0;
3324 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3325 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3326 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3327 ret_ref = (uintptr_t)ret_var.inner;
3328 if (ret_var.is_owned) {
3334 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3335 CHECK(owner->result_ok);
3336 return ChannelFeatures_clone(&*owner->contents.result);
3338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3339 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3340 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3341 int64_t ret_ref = 0;
3342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3345 ret_ref = (uintptr_t)ret_var.inner;
3346 if (ret_var.is_owned) {
3352 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3353 CHECK(!owner->result_ok);
3354 return DecodeError_clone(&*owner->contents.err);
3356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3357 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3358 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3359 int64_t ret_ref = 0;
3360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3363 ret_ref = (uintptr_t)ret_var.inner;
3364 if (ret_var.is_owned) {
3370 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3371 CHECK(owner->result_ok);
3372 return NodeFeatures_clone(&*owner->contents.result);
3374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3375 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3376 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3377 int64_t ret_ref = 0;
3378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3381 ret_ref = (uintptr_t)ret_var.inner;
3382 if (ret_var.is_owned) {
3388 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3389 CHECK(!owner->result_ok);
3390 return DecodeError_clone(&*owner->contents.err);
3392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3393 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3394 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3395 int64_t ret_ref = 0;
3396 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3397 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3398 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3399 ret_ref = (uintptr_t)ret_var.inner;
3400 if (ret_var.is_owned) {
3406 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3407 CHECK(owner->result_ok);
3408 return InvoiceFeatures_clone(&*owner->contents.result);
3410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3411 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3412 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3413 int64_t ret_ref = 0;
3414 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3415 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3416 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3417 ret_ref = (uintptr_t)ret_var.inner;
3418 if (ret_var.is_owned) {
3424 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3425 CHECK(!owner->result_ok);
3426 return DecodeError_clone(&*owner->contents.err);
3428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3429 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3430 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3431 int64_t ret_ref = 0;
3432 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3433 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3434 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3435 ret_ref = (uintptr_t)ret_var.inner;
3436 if (ret_var.is_owned) {
3442 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3443 CHECK(owner->result_ok);
3444 return ChannelTypeFeatures_clone(&*owner->contents.result);
3446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3447 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3448 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3449 int64_t ret_ref = 0;
3450 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3451 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3452 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3453 ret_ref = (uintptr_t)ret_var.inner;
3454 if (ret_var.is_owned) {
3460 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3461 CHECK(!owner->result_ok);
3462 return DecodeError_clone(&*owner->contents.err);
3464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3465 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3466 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3467 int64_t ret_ref = 0;
3468 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3469 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3471 ret_ref = (uintptr_t)ret_var.inner;
3472 if (ret_var.is_owned) {
3478 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3479 CHECK(owner->result_ok);
3480 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
3482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3483 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3484 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3485 int64_t ret_ref = 0;
3486 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3487 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3488 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3489 ret_ref = (uintptr_t)ret_var.inner;
3490 if (ret_var.is_owned) {
3496 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3497 CHECK(!owner->result_ok);
3498 return DecodeError_clone(&*owner->contents.err);
3500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3501 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3502 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3503 int64_t ret_ref = 0;
3504 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3505 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3506 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3507 ret_ref = (uintptr_t)ret_var.inner;
3508 if (ret_var.is_owned) {
3514 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3515 CHECK(owner->result_ok);
3516 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
3518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3519 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3520 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3521 int64_t ret_ref = 0;
3522 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3523 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3524 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3525 ret_ref = (uintptr_t)ret_var.inner;
3526 if (ret_var.is_owned) {
3532 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3533 CHECK(!owner->result_ok);
3534 return DecodeError_clone(&*owner->contents.err);
3536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3537 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3538 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3539 int64_t ret_ref = 0;
3540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3543 ret_ref = (uintptr_t)ret_var.inner;
3544 if (ret_var.is_owned) {
3550 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3551 CHECK(owner->result_ok);
3552 return SpendableOutputDescriptor_clone(&*owner->contents.result);
3554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3555 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3556 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3557 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3558 int64_t ret_ref = (uintptr_t)ret_copy;
3562 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3563 CHECK(!owner->result_ok);
3564 return DecodeError_clone(&*owner->contents.err);
3566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3567 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3568 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3569 int64_t ret_ref = 0;
3570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3573 ret_ref = (uintptr_t)ret_var.inner;
3574 if (ret_var.is_owned) {
3580 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3581 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3582 for (size_t i = 0; i < ret.datalen; i++) {
3583 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3587 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3591 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3592 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3593 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
3597 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3600 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3601 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3602 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3603 jobjectArray ret_arr = NULL;
3604 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3606 for (size_t i = 0; i < ret_var.datalen; i++) {
3607 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
3608 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
3609 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3615 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3616 CHECK(owner->result_ok);
3617 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3620 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3621 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3622 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3623 return ((int64_t)ret_conv);
3626 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3627 CHECK(!owner->result_ok);
3628 return *owner->contents.err;
3630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3631 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3632 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3635 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3636 CHECK(owner->result_ok);
3637 return *owner->contents.result;
3639 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3640 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3641 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3642 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
3646 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3647 CHECK(!owner->result_ok);
3648 return *owner->contents.err;
3650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3651 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3652 CResult_SignatureNoneZ_get_err(owner_conv);
3655 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3658 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3659 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3660 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3661 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
3665 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3669 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3670 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3671 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
3675 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3676 CHECK(owner->result_ok);
3677 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3680 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3681 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3682 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3683 return ((int64_t)ret_conv);
3686 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3687 CHECK(!owner->result_ok);
3688 return *owner->contents.err;
3690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3691 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3692 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3695 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3696 CHECK(owner->result_ok);
3697 return *owner->contents.result;
3699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3700 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3701 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3702 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
3706 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3707 CHECK(!owner->result_ok);
3708 return *owner->contents.err;
3710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3711 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3712 CResult_SecretKeyNoneZ_get_err(owner_conv);
3715 typedef struct LDKBaseSign_JCalls {
3716 atomic_size_t refcnt;
3719 jmethodID get_per_commitment_point_meth;
3720 jmethodID release_commitment_secret_meth;
3721 jmethodID validate_holder_commitment_meth;
3722 jmethodID channel_keys_id_meth;
3723 jmethodID sign_counterparty_commitment_meth;
3724 jmethodID validate_counterparty_revocation_meth;
3725 jmethodID sign_holder_commitment_and_htlcs_meth;
3726 jmethodID sign_justice_revoked_output_meth;
3727 jmethodID sign_justice_revoked_htlc_meth;
3728 jmethodID sign_counterparty_htlc_transaction_meth;
3729 jmethodID sign_closing_transaction_meth;
3730 jmethodID sign_channel_announcement_meth;
3731 jmethodID ready_channel_meth;
3732 } LDKBaseSign_JCalls;
3733 static void LDKBaseSign_JCalls_free(void* this_arg) {
3734 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3735 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3737 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3738 if (get_jenv_res == JNI_EDETACHED) {
3739 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3741 DO_ASSERT(get_jenv_res == JNI_OK);
3743 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3744 if (get_jenv_res == JNI_EDETACHED) {
3745 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3750 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3751 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3753 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3754 if (get_jenv_res == JNI_EDETACHED) {
3755 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3757 DO_ASSERT(get_jenv_res == JNI_OK);
3759 int64_t idx_conv = idx;
3760 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3762 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
3763 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3764 (*env)->ExceptionDescribe(env);
3765 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
3767 LDKPublicKey ret_ref;
3768 CHECK((*env)->GetArrayLength(env, ret) == 33);
3769 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3770 if (get_jenv_res == JNI_EDETACHED) {
3771 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3775 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3776 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3778 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3779 if (get_jenv_res == JNI_EDETACHED) {
3780 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3782 DO_ASSERT(get_jenv_res == JNI_OK);
3784 int64_t idx_conv = idx;
3785 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3787 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
3788 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3789 (*env)->ExceptionDescribe(env);
3790 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
3792 LDKThirtyTwoBytes ret_ref;
3793 CHECK((*env)->GetArrayLength(env, ret) == 32);
3794 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3795 if (get_jenv_res == JNI_EDETACHED) {
3796 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3800 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3801 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3803 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3804 if (get_jenv_res == JNI_EDETACHED) {
3805 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3807 DO_ASSERT(get_jenv_res == JNI_OK);
3809 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3810 int64_t holder_tx_ref = 0;
3811 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3812 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3813 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3814 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3815 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
3816 if (holder_tx_var.is_owned) {
3819 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3820 jobjectArray preimages_arr = NULL;
3821 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
3823 for (size_t i = 0; i < preimages_var.datalen; i++) {
3824 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3825 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
3826 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
3829 FREE(preimages_var.data);
3830 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3832 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
3833 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3834 (*env)->ExceptionDescribe(env);
3835 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
3837 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3838 CHECK_ACCESS(ret_ptr);
3839 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3841 if (get_jenv_res == JNI_EDETACHED) {
3842 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3846 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3847 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3849 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3850 if (get_jenv_res == JNI_EDETACHED) {
3851 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3853 DO_ASSERT(get_jenv_res == JNI_OK);
3855 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3857 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
3858 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3859 (*env)->ExceptionDescribe(env);
3860 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
3862 LDKThirtyTwoBytes ret_ref;
3863 CHECK((*env)->GetArrayLength(env, ret) == 32);
3864 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3865 if (get_jenv_res == JNI_EDETACHED) {
3866 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3870 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3871 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3873 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3874 if (get_jenv_res == JNI_EDETACHED) {
3875 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3877 DO_ASSERT(get_jenv_res == JNI_OK);
3879 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3880 int64_t commitment_tx_ref = 0;
3881 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3882 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3883 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3884 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3885 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3886 if (commitment_tx_var.is_owned) {
3887 commitment_tx_ref |= 1;
3889 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3890 jobjectArray preimages_arr = NULL;
3891 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
3893 for (size_t i = 0; i < preimages_var.datalen; i++) {
3894 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3895 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
3896 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
3899 FREE(preimages_var.data);
3900 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3902 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
3903 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3904 (*env)->ExceptionDescribe(env);
3905 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
3907 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3908 CHECK_ACCESS(ret_ptr);
3909 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3911 if (get_jenv_res == JNI_EDETACHED) {
3912 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3916 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3917 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3919 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3920 if (get_jenv_res == JNI_EDETACHED) {
3921 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3923 DO_ASSERT(get_jenv_res == JNI_OK);
3925 int64_t idx_conv = idx;
3926 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
3927 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
3928 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3930 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
3931 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3932 (*env)->ExceptionDescribe(env);
3933 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
3935 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3936 CHECK_ACCESS(ret_ptr);
3937 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3939 if (get_jenv_res == JNI_EDETACHED) {
3940 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3944 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3945 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3947 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3948 if (get_jenv_res == JNI_EDETACHED) {
3949 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3951 DO_ASSERT(get_jenv_res == JNI_OK);
3953 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3954 int64_t commitment_tx_ref = 0;
3955 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3956 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3957 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3958 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3959 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3960 if (commitment_tx_var.is_owned) {
3961 commitment_tx_ref |= 1;
3963 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3965 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
3966 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3967 (*env)->ExceptionDescribe(env);
3968 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
3970 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3971 CHECK_ACCESS(ret_ptr);
3972 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3974 if (get_jenv_res == JNI_EDETACHED) {
3975 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3979 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]) {
3980 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3982 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3983 if (get_jenv_res == JNI_EDETACHED) {
3984 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3986 DO_ASSERT(get_jenv_res == JNI_OK);
3988 LDKTransaction justice_tx_var = justice_tx;
3989 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3990 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3991 Transaction_free(justice_tx_var);
3992 int64_t input_conv = input;
3993 int64_t amount_conv = amount;
3994 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3995 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3996 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3998 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr);
3999 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4000 (*env)->ExceptionDescribe(env);
4001 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
4003 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4004 CHECK_ACCESS(ret_ptr);
4005 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4007 if (get_jenv_res == JNI_EDETACHED) {
4008 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4012 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) {
4013 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4015 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4016 if (get_jenv_res == JNI_EDETACHED) {
4017 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4019 DO_ASSERT(get_jenv_res == JNI_OK);
4021 LDKTransaction justice_tx_var = justice_tx;
4022 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
4023 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
4024 Transaction_free(justice_tx_var);
4025 int64_t input_conv = input;
4026 int64_t amount_conv = amount;
4027 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
4028 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
4029 LDKHTLCOutputInCommitment htlc_var = *htlc;
4030 int64_t htlc_ref = 0;
4031 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4032 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4033 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4034 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4035 htlc_ref = (uintptr_t)htlc_var.inner;
4036 if (htlc_var.is_owned) {
4039 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4041 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input_conv, amount_conv, per_commitment_key_arr, htlc_ref);
4042 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4043 (*env)->ExceptionDescribe(env);
4044 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
4046 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4047 CHECK_ACCESS(ret_ptr);
4048 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4050 if (get_jenv_res == JNI_EDETACHED) {
4051 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4055 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) {
4056 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4058 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4059 if (get_jenv_res == JNI_EDETACHED) {
4060 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4062 DO_ASSERT(get_jenv_res == JNI_OK);
4064 LDKTransaction htlc_tx_var = htlc_tx;
4065 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
4066 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
4067 Transaction_free(htlc_tx_var);
4068 int64_t input_conv = input;
4069 int64_t amount_conv = amount;
4070 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
4071 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
4072 LDKHTLCOutputInCommitment htlc_var = *htlc;
4073 int64_t htlc_ref = 0;
4074 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4075 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4076 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4077 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4078 htlc_ref = (uintptr_t)htlc_var.inner;
4079 if (htlc_var.is_owned) {
4082 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4084 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input_conv, amount_conv, per_commitment_point_arr, htlc_ref);
4085 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4086 (*env)->ExceptionDescribe(env);
4087 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
4089 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4090 CHECK_ACCESS(ret_ptr);
4091 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4093 if (get_jenv_res == JNI_EDETACHED) {
4094 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4098 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4099 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4101 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4102 if (get_jenv_res == JNI_EDETACHED) {
4103 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4105 DO_ASSERT(get_jenv_res == JNI_OK);
4107 LDKClosingTransaction closing_tx_var = *closing_tx;
4108 int64_t closing_tx_ref = 0;
4109 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4110 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4111 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4112 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4113 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
4114 if (closing_tx_var.is_owned) {
4115 closing_tx_ref |= 1;
4117 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4119 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
4120 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4121 (*env)->ExceptionDescribe(env);
4122 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
4124 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4125 CHECK_ACCESS(ret_ptr);
4126 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4128 if (get_jenv_res == JNI_EDETACHED) {
4129 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4133 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4134 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4136 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4137 if (get_jenv_res == JNI_EDETACHED) {
4138 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4140 DO_ASSERT(get_jenv_res == JNI_OK);
4142 LDKUnsignedChannelAnnouncement msg_var = *msg;
4143 int64_t msg_ref = 0;
4144 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4145 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4146 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4147 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4148 msg_ref = (uintptr_t)msg_var.inner;
4149 if (msg_var.is_owned) {
4152 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4154 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
4155 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4156 (*env)->ExceptionDescribe(env);
4157 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
4159 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4160 CHECK_ACCESS(ret_ptr);
4161 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4163 if (get_jenv_res == JNI_EDETACHED) {
4164 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4168 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4169 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4171 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4172 if (get_jenv_res == JNI_EDETACHED) {
4173 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4175 DO_ASSERT(get_jenv_res == JNI_OK);
4177 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4178 int64_t channel_parameters_ref = 0;
4179 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4180 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4181 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4182 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4183 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
4184 if (channel_parameters_var.is_owned) {
4185 channel_parameters_ref |= 1;
4187 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4189 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
4190 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4191 (*env)->ExceptionDescribe(env);
4192 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
4194 if (get_jenv_res == JNI_EDETACHED) {
4195 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4198 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4199 jclass c = (*env)->GetObjectClass(env, o);
4201 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4202 atomic_init(&calls->refcnt, 1);
4203 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4204 calls->o = (*env)->NewWeakGlobalRef(env, o);
4205 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
4206 CHECK(calls->get_per_commitment_point_meth != NULL);
4207 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
4208 CHECK(calls->release_commitment_secret_meth != NULL);
4209 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
4210 CHECK(calls->validate_holder_commitment_meth != NULL);
4211 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
4212 CHECK(calls->channel_keys_id_meth != NULL);
4213 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
4214 CHECK(calls->sign_counterparty_commitment_meth != NULL);
4215 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
4216 CHECK(calls->validate_counterparty_revocation_meth != NULL);
4217 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
4218 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
4219 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
4220 CHECK(calls->sign_justice_revoked_output_meth != NULL);
4221 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
4222 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
4223 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
4224 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
4225 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
4226 CHECK(calls->sign_closing_transaction_meth != NULL);
4227 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
4228 CHECK(calls->sign_channel_announcement_meth != NULL);
4229 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
4230 CHECK(calls->ready_channel_meth != NULL);
4232 LDKChannelPublicKeys pubkeys_conv;
4233 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4234 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4235 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4238 .this_arg = (void*) calls,
4239 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4240 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4241 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4242 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4243 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4244 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4245 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4246 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4247 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
4248 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
4249 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
4250 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
4251 .ready_channel = ready_channel_LDKBaseSign_jcall,
4252 .free = LDKBaseSign_JCalls_free,
4253 .pubkeys = pubkeys_conv,
4254 .set_pubkeys = NULL,
4258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4259 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
4260 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
4261 return (uint64_t)res_ptr;
4263 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) {
4264 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4265 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4266 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4267 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4268 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
4272 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
4273 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4274 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4275 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4276 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4277 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
4281 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, jobjectArray preimages) {
4282 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4283 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4284 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4285 LDKHolderCommitmentTransaction holder_tx_conv;
4286 holder_tx_conv.inner = (void*)(holder_tx & (~1));
4287 holder_tx_conv.is_owned = false;
4288 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4289 LDKCVec_PaymentPreimageZ preimages_constr;
4290 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4291 if (preimages_constr.datalen > 0)
4292 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4294 preimages_constr.data = NULL;
4295 for (size_t i = 0; i < preimages_constr.datalen; i++) {
4296 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4297 LDKThirtyTwoBytes preimages_conv_8_ref;
4298 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4299 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4300 preimages_constr.data[i] = preimages_conv_8_ref;
4302 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4303 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4304 return (int64_t)ret_conv;
4307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4308 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4309 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4310 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4311 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4312 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
4316 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, jobjectArray preimages) {
4317 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4318 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4319 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4320 LDKCommitmentTransaction commitment_tx_conv;
4321 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4322 commitment_tx_conv.is_owned = false;
4323 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4324 LDKCVec_PaymentPreimageZ preimages_constr;
4325 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4326 if (preimages_constr.datalen > 0)
4327 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4329 preimages_constr.data = NULL;
4330 for (size_t i = 0; i < preimages_constr.datalen; i++) {
4331 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4332 LDKThirtyTwoBytes preimages_conv_8_ref;
4333 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4334 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4335 preimages_constr.data[i] = preimages_conv_8_ref;
4337 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4338 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4339 return (int64_t)ret_conv;
4342 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) {
4343 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4344 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4345 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4346 unsigned char secret_arr[32];
4347 CHECK((*env)->GetArrayLength(env, secret) == 32);
4348 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
4349 unsigned char (*secret_ref)[32] = &secret_arr;
4350 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4351 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4352 return (int64_t)ret_conv;
4355 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) {
4356 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4357 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4358 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4359 LDKHolderCommitmentTransaction commitment_tx_conv;
4360 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4361 commitment_tx_conv.is_owned = false;
4362 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4363 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4364 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4365 return (int64_t)ret_conv;
4368 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) {
4369 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4370 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4371 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4372 LDKTransaction justice_tx_ref;
4373 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
4374 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4375 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
4376 justice_tx_ref.data_is_owned = true;
4377 unsigned char per_commitment_key_arr[32];
4378 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
4379 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
4380 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4381 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4382 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4383 return (int64_t)ret_conv;
4386 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) {
4387 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4388 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4389 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4390 LDKTransaction justice_tx_ref;
4391 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
4392 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4393 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
4394 justice_tx_ref.data_is_owned = true;
4395 unsigned char per_commitment_key_arr[32];
4396 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
4397 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
4398 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4399 LDKHTLCOutputInCommitment htlc_conv;
4400 htlc_conv.inner = (void*)(htlc & (~1));
4401 htlc_conv.is_owned = false;
4402 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4403 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4404 *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);
4405 return (int64_t)ret_conv;
4408 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) {
4409 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4410 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4411 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4412 LDKTransaction htlc_tx_ref;
4413 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
4414 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4415 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
4416 htlc_tx_ref.data_is_owned = true;
4417 LDKPublicKey per_commitment_point_ref;
4418 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
4419 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
4420 LDKHTLCOutputInCommitment htlc_conv;
4421 htlc_conv.inner = (void*)(htlc & (~1));
4422 htlc_conv.is_owned = false;
4423 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4424 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4425 *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);
4426 return (int64_t)ret_conv;
4429 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) {
4430 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4431 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4432 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4433 LDKClosingTransaction closing_tx_conv;
4434 closing_tx_conv.inner = (void*)(closing_tx & (~1));
4435 closing_tx_conv.is_owned = false;
4436 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4437 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4438 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4439 return (int64_t)ret_conv;
4442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
4443 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4444 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4445 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4446 LDKUnsignedChannelAnnouncement msg_conv;
4447 msg_conv.inner = (void*)(msg & (~1));
4448 msg_conv.is_owned = false;
4449 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4450 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4451 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4452 return (int64_t)ret_conv;
4455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
4456 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4457 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4458 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4459 LDKChannelTransactionParameters channel_parameters_conv;
4460 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
4461 channel_parameters_conv.is_owned = false;
4462 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4463 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4466 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4467 if (this_arg->set_pubkeys != NULL)
4468 this_arg->set_pubkeys(this_arg);
4469 return this_arg->pubkeys;
4471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
4472 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4473 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4474 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4475 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4476 int64_t ret_ref = 0;
4477 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4478 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4479 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4480 ret_ref = (uintptr_t)ret_var.inner;
4481 if (ret_var.is_owned) {
4487 typedef struct LDKSign_JCalls {
4488 atomic_size_t refcnt;
4491 LDKBaseSign_JCalls* BaseSign;
4492 jmethodID write_meth;
4494 static void LDKSign_JCalls_free(void* this_arg) {
4495 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4496 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4498 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4499 if (get_jenv_res == JNI_EDETACHED) {
4500 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4502 DO_ASSERT(get_jenv_res == JNI_OK);
4504 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4505 if (get_jenv_res == JNI_EDETACHED) {
4506 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4511 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4512 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4514 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4515 if (get_jenv_res == JNI_EDETACHED) {
4516 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4518 DO_ASSERT(get_jenv_res == JNI_OK);
4520 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4522 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4523 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4524 (*env)->ExceptionDescribe(env);
4525 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
4527 LDKCVec_u8Z ret_ref;
4528 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4529 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4530 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4531 if (get_jenv_res == JNI_EDETACHED) {
4532 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4536 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4537 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4538 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4539 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4541 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
4542 jclass c = (*env)->GetObjectClass(env, o);
4544 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4545 atomic_init(&calls->refcnt, 1);
4546 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4547 calls->o = (*env)->NewWeakGlobalRef(env, o);
4548 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4549 CHECK(calls->write_meth != NULL);
4551 LDKChannelPublicKeys pubkeys_conv;
4552 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4553 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4554 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4557 .this_arg = (void*) calls,
4558 .write = write_LDKSign_jcall,
4559 .cloned = LDKSign_JCalls_cloned,
4560 .free = LDKSign_JCalls_free,
4561 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
4563 calls->BaseSign = ret.BaseSign.this_arg;
4566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
4567 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4568 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
4569 return (uint64_t)res_ptr;
4571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
4572 LDKSign *inp = (LDKSign *)(arg & ~1);
4573 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
4574 DO_ASSERT((res_ptr & 1) == 0);
4575 return (int64_t)(res_ptr | 1);
4577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4578 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4579 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4580 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4581 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4582 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4583 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4584 CVec_u8Z_free(ret_var);
4588 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4589 CHECK(owner->result_ok);
4590 return Sign_clone(&*owner->contents.result);
4592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4593 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4594 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4595 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4596 return (int64_t)ret_ret;
4599 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4600 CHECK(!owner->result_ok);
4601 return DecodeError_clone(&*owner->contents.err);
4603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4604 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4605 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4606 int64_t ret_ref = 0;
4607 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4608 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4610 ret_ref = (uintptr_t)ret_var.inner;
4611 if (ret_var.is_owned) {
4617 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4618 CHECK(owner->result_ok);
4619 return *owner->contents.result;
4621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4622 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4623 int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
4624 (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
4628 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4629 CHECK(!owner->result_ok);
4630 return *owner->contents.err;
4632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4633 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4634 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4637 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4638 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4639 for (size_t i = 0; i < ret.datalen; i++) {
4640 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4644 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4645 CHECK(owner->result_ok);
4646 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4648 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4649 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4650 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4651 jobjectArray ret_arr = NULL;
4652 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4654 for (size_t i = 0; i < ret_var.datalen; i++) {
4655 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
4656 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
4657 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
4658 CVec_u8Z_free(ret_conv_8_var);
4659 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4666 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4667 CHECK(!owner->result_ok);
4668 return *owner->contents.err;
4670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4671 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4672 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4675 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4676 CHECK(owner->result_ok);
4677 return InMemorySigner_clone(&*owner->contents.result);
4679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4680 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4681 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4682 int64_t ret_ref = 0;
4683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4686 ret_ref = (uintptr_t)ret_var.inner;
4687 if (ret_var.is_owned) {
4693 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4694 CHECK(!owner->result_ok);
4695 return DecodeError_clone(&*owner->contents.err);
4697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4698 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4699 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4700 int64_t ret_ref = 0;
4701 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4702 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4704 ret_ref = (uintptr_t)ret_var.inner;
4705 if (ret_var.is_owned) {
4711 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4712 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4713 for (size_t i = 0; i < ret.datalen; i++) {
4714 ret.data[i] = TxOut_clone(&orig->data[i]);
4718 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4719 CHECK(owner->result_ok);
4720 return *owner->contents.result;
4722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4723 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4724 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4725 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4726 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4730 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4731 CHECK(!owner->result_ok);
4732 return *owner->contents.err;
4734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4735 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4736 CResult_TransactionNoneZ_get_err(owner_conv);
4739 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
4740 return ThirtyTwoBytes_clone(&owner->a);
4742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4743 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
4744 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4745 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
4749 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
4750 return ChannelMonitor_clone(&owner->b);
4752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4753 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
4754 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
4755 int64_t ret_ref = 0;
4756 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4757 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4758 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4759 ret_ref = (uintptr_t)ret_var.inner;
4760 if (ret_var.is_owned) {
4766 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
4767 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
4768 for (size_t i = 0; i < ret.datalen; i++) {
4769 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
4773 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
4774 CHECK(owner->result_ok);
4775 return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
4777 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4778 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
4779 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
4780 int64_tArray ret_arr = NULL;
4781 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4782 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4783 for (size_t j = 0; j < ret_var.datalen; j++) {
4784 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4785 *ret_conv_35_conv = ret_var.data[j];
4786 ret_arr_ptr[j] = ((int64_t)ret_conv_35_conv);
4788 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4793 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
4794 CHECK(!owner->result_ok);
4795 return *owner->contents.err;
4797 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4798 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
4799 jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
4803 static jclass LDKCOption_u16Z_Some_class = NULL;
4804 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
4805 static jclass LDKCOption_u16Z_None_class = NULL;
4806 static jmethodID LDKCOption_u16Z_None_meth = NULL;
4807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
4808 LDKCOption_u16Z_Some_class =
4809 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
4810 CHECK(LDKCOption_u16Z_Some_class != NULL);
4811 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
4812 CHECK(LDKCOption_u16Z_Some_meth != NULL);
4813 LDKCOption_u16Z_None_class =
4814 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
4815 CHECK(LDKCOption_u16Z_None_class != NULL);
4816 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
4817 CHECK(LDKCOption_u16Z_None_meth != NULL);
4819 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4820 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4822 case LDKCOption_u16Z_Some: {
4823 int16_t some_conv = obj->some;
4824 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
4826 case LDKCOption_u16Z_None: {
4827 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
4832 static jclass LDKAPIError_APIMisuseError_class = NULL;
4833 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
4834 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
4835 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
4836 static jclass LDKAPIError_RouteError_class = NULL;
4837 static jmethodID LDKAPIError_RouteError_meth = NULL;
4838 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
4839 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
4840 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
4841 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
4842 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
4843 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
4844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
4845 LDKAPIError_APIMisuseError_class =
4846 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
4847 CHECK(LDKAPIError_APIMisuseError_class != NULL);
4848 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
4849 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
4850 LDKAPIError_FeeRateTooHigh_class =
4851 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
4852 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
4853 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
4854 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
4855 LDKAPIError_RouteError_class =
4856 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
4857 CHECK(LDKAPIError_RouteError_class != NULL);
4858 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
4859 CHECK(LDKAPIError_RouteError_meth != NULL);
4860 LDKAPIError_ChannelUnavailable_class =
4861 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
4862 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
4863 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
4864 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
4865 LDKAPIError_MonitorUpdateFailed_class =
4866 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
4867 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
4868 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
4869 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
4870 LDKAPIError_IncompatibleShutdownScript_class =
4871 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
4872 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
4873 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
4874 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
4876 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4877 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4879 case LDKAPIError_APIMisuseError: {
4880 LDKStr err_str = obj->api_misuse_error.err;
4881 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4882 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
4884 case LDKAPIError_FeeRateTooHigh: {
4885 LDKStr err_str = obj->fee_rate_too_high.err;
4886 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4887 int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4888 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
4890 case LDKAPIError_RouteError: {
4891 LDKStr err_str = obj->route_error.err;
4892 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4893 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
4895 case LDKAPIError_ChannelUnavailable: {
4896 LDKStr err_str = obj->channel_unavailable.err;
4897 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4898 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
4900 case LDKAPIError_MonitorUpdateFailed: {
4901 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
4903 case LDKAPIError_IncompatibleShutdownScript: {
4904 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4905 int64_t script_ref = 0;
4906 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4907 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4908 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4909 script_ref = (uintptr_t)script_var.inner & ~1;
4910 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
4915 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4916 CHECK(owner->result_ok);
4917 return *owner->contents.result;
4919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4920 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4921 CResult_NoneAPIErrorZ_get_ok(owner_conv);
4924 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4925 CHECK(!owner->result_ok);
4926 return APIError_clone(&*owner->contents.err);
4928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4929 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4930 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4931 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4932 int64_t ret_ref = (uintptr_t)ret_copy;
4936 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4937 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4938 for (size_t i = 0; i < ret.datalen; i++) {
4939 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4943 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4944 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4945 for (size_t i = 0; i < ret.datalen; i++) {
4946 ret.data[i] = APIError_clone(&orig->data[i]);
4950 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4951 CHECK(owner->result_ok);
4952 return ThirtyTwoBytes_clone(&*owner->contents.result);
4954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4955 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4956 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4957 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
4961 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4962 CHECK(!owner->result_ok);
4963 return APIError_clone(&*owner->contents.err);
4965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4966 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4967 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4968 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4969 int64_t ret_ref = (uintptr_t)ret_copy;
4973 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
4974 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
4975 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
4976 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
4977 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
4978 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
4979 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
4980 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
4981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
4982 LDKPaymentSendFailure_ParameterError_class =
4983 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
4984 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
4985 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
4986 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
4987 LDKPaymentSendFailure_PathParameterError_class =
4988 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
4989 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
4990 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
4991 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
4992 LDKPaymentSendFailure_AllFailedRetrySafe_class =
4993 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
4994 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
4995 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
4996 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
4997 LDKPaymentSendFailure_PartialFailure_class =
4998 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
4999 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
5000 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
5001 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
5003 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5004 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
5006 case LDKPaymentSendFailure_ParameterError: {
5007 int64_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
5008 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
5010 case LDKPaymentSendFailure_PathParameterError: {
5011 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
5012 int64_tArray path_parameter_error_arr = NULL;
5013 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
5014 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
5015 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
5016 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5017 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
5018 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
5019 path_parameter_error_arr_ptr[w] = (int64_t)path_parameter_error_conv_22_conv;
5021 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
5022 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
5024 case LDKPaymentSendFailure_AllFailedRetrySafe: {
5025 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
5026 int64_tArray all_failed_retry_safe_arr = NULL;
5027 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
5028 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
5029 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
5030 int64_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
5031 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
5033 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
5034 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
5036 case LDKPaymentSendFailure_PartialFailure: {
5037 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
5038 int64_tArray results_arr = NULL;
5039 results_arr = (*env)->NewLongArray(env, results_var.datalen);
5040 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
5041 for (size_t w = 0; w < results_var.datalen; w++) {
5042 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5043 *results_conv_22_conv = results_var.data[w];
5044 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
5045 results_arr_ptr[w] = (int64_t)results_conv_22_conv;
5047 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
5048 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
5049 int64_t failed_paths_retry_ref = 0;
5050 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
5051 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5052 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5053 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
5054 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
5056 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
5057 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
5058 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
5063 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5064 CHECK(owner->result_ok);
5065 return ThirtyTwoBytes_clone(&*owner->contents.result);
5067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5068 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5069 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5070 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
5074 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5075 CHECK(!owner->result_ok);
5076 return PaymentSendFailure_clone(&*owner->contents.err);
5078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5079 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5080 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5081 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
5082 int64_t ret_ref = (uintptr_t)ret_copy;
5086 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5087 CHECK(owner->result_ok);
5088 return *owner->contents.result;
5090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5091 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5092 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5095 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5096 CHECK(!owner->result_ok);
5097 return PaymentSendFailure_clone(&*owner->contents.err);
5099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5100 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5101 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5102 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5103 int64_t ret_ref = (uintptr_t)ret_copy;
5107 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5108 return ThirtyTwoBytes_clone(&owner->a);
5110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5111 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5112 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5113 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
5117 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5118 return ThirtyTwoBytes_clone(&owner->b);
5120 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5121 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5122 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5123 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
5127 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5128 CHECK(owner->result_ok);
5129 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5132 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5133 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5134 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5135 return ((int64_t)ret_conv);
5138 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5139 CHECK(!owner->result_ok);
5140 return PaymentSendFailure_clone(&*owner->contents.err);
5142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5143 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5144 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5145 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5146 int64_t ret_ref = (uintptr_t)ret_copy;
5150 static jclass LDKNetAddress_IPv4_class = NULL;
5151 static jmethodID LDKNetAddress_IPv4_meth = NULL;
5152 static jclass LDKNetAddress_IPv6_class = NULL;
5153 static jmethodID LDKNetAddress_IPv6_meth = NULL;
5154 static jclass LDKNetAddress_OnionV2_class = NULL;
5155 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
5156 static jclass LDKNetAddress_OnionV3_class = NULL;
5157 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
5158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
5159 LDKNetAddress_IPv4_class =
5160 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
5161 CHECK(LDKNetAddress_IPv4_class != NULL);
5162 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
5163 CHECK(LDKNetAddress_IPv4_meth != NULL);
5164 LDKNetAddress_IPv6_class =
5165 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
5166 CHECK(LDKNetAddress_IPv6_class != NULL);
5167 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
5168 CHECK(LDKNetAddress_IPv6_meth != NULL);
5169 LDKNetAddress_OnionV2_class =
5170 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
5171 CHECK(LDKNetAddress_OnionV2_class != NULL);
5172 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
5173 CHECK(LDKNetAddress_OnionV2_meth != NULL);
5174 LDKNetAddress_OnionV3_class =
5175 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
5176 CHECK(LDKNetAddress_OnionV3_class != NULL);
5177 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
5178 CHECK(LDKNetAddress_OnionV3_meth != NULL);
5180 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5181 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
5183 case LDKNetAddress_IPv4: {
5184 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
5185 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
5186 int16_t port_conv = obj->i_pv4.port;
5187 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, port_conv);
5189 case LDKNetAddress_IPv6: {
5190 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
5191 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
5192 int16_t port_conv = obj->i_pv6.port;
5193 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, port_conv);
5195 case LDKNetAddress_OnionV2: {
5196 int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
5197 (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
5198 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
5200 case LDKNetAddress_OnionV3: {
5201 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
5202 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
5203 int16_t checksum_conv = obj->onion_v3.checksum;
5204 int8_t version_conv = obj->onion_v3.version;
5205 int16_t port_conv = obj->onion_v3.port;
5206 return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
5211 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
5212 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
5213 for (size_t i = 0; i < ret.datalen; i++) {
5214 ret.data[i] = NetAddress_clone(&orig->data[i]);
5218 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5219 return ThirtyTwoBytes_clone(&owner->a);
5221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5222 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5223 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5224 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
5228 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5229 return ThirtyTwoBytes_clone(&owner->b);
5231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5232 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5233 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5234 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
5238 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5239 CHECK(owner->result_ok);
5240 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5243 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5244 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5245 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5246 return ((int64_t)ret_conv);
5249 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5250 CHECK(!owner->result_ok);
5251 return *owner->contents.err;
5253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5254 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5255 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5258 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5259 CHECK(owner->result_ok);
5260 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5263 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5264 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5265 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5266 return ((int64_t)ret_conv);
5269 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5270 CHECK(!owner->result_ok);
5271 return APIError_clone(&*owner->contents.err);
5273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5274 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5275 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5276 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5277 int64_t ret_ref = (uintptr_t)ret_copy;
5281 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5282 CHECK(owner->result_ok);
5283 return ThirtyTwoBytes_clone(&*owner->contents.result);
5285 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5286 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5287 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5288 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
5292 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5293 CHECK(!owner->result_ok);
5294 return *owner->contents.err;
5296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5297 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5298 CResult_PaymentSecretNoneZ_get_err(owner_conv);
5301 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5302 CHECK(owner->result_ok);
5303 return ThirtyTwoBytes_clone(&*owner->contents.result);
5305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5306 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5307 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5308 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
5312 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5313 CHECK(!owner->result_ok);
5314 return APIError_clone(&*owner->contents.err);
5316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5317 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5318 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5319 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5320 int64_t ret_ref = (uintptr_t)ret_copy;
5324 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5325 CHECK(owner->result_ok);
5326 return ThirtyTwoBytes_clone(&*owner->contents.result);
5328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5329 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5330 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5331 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
5335 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5336 CHECK(!owner->result_ok);
5337 return APIError_clone(&*owner->contents.err);
5339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5340 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5341 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5342 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5343 int64_t ret_ref = (uintptr_t)ret_copy;
5347 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5348 CHECK(owner->result_ok);
5349 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
5351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5352 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
5353 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5354 int64_t ret_ref = 0;
5355 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5356 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5357 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5358 ret_ref = (uintptr_t)ret_var.inner;
5359 if (ret_var.is_owned) {
5365 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5366 CHECK(!owner->result_ok);
5367 return DecodeError_clone(&*owner->contents.err);
5369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5370 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
5371 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5372 int64_t ret_ref = 0;
5373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5376 ret_ref = (uintptr_t)ret_var.inner;
5377 if (ret_var.is_owned) {
5383 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5384 CHECK(owner->result_ok);
5385 return ChannelCounterparty_clone(&*owner->contents.result);
5387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5388 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
5389 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5390 int64_t ret_ref = 0;
5391 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5392 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5393 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5394 ret_ref = (uintptr_t)ret_var.inner;
5395 if (ret_var.is_owned) {
5401 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5402 CHECK(!owner->result_ok);
5403 return DecodeError_clone(&*owner->contents.err);
5405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5406 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
5407 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5408 int64_t ret_ref = 0;
5409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5412 ret_ref = (uintptr_t)ret_var.inner;
5413 if (ret_var.is_owned) {
5419 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5420 CHECK(owner->result_ok);
5421 return ChannelDetails_clone(&*owner->contents.result);
5423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5424 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
5425 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5426 int64_t ret_ref = 0;
5427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5430 ret_ref = (uintptr_t)ret_var.inner;
5431 if (ret_var.is_owned) {
5437 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5438 CHECK(!owner->result_ok);
5439 return DecodeError_clone(&*owner->contents.err);
5441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5442 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
5443 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5444 int64_t ret_ref = 0;
5445 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5446 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5448 ret_ref = (uintptr_t)ret_var.inner;
5449 if (ret_var.is_owned) {
5455 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5456 CHECK(owner->result_ok);
5457 return PhantomRouteHints_clone(&*owner->contents.result);
5459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5460 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
5461 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5462 int64_t ret_ref = 0;
5463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5466 ret_ref = (uintptr_t)ret_var.inner;
5467 if (ret_var.is_owned) {
5473 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5474 CHECK(!owner->result_ok);
5475 return DecodeError_clone(&*owner->contents.err);
5477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5478 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
5479 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5480 int64_t ret_ref = 0;
5481 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5482 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5483 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5484 ret_ref = (uintptr_t)ret_var.inner;
5485 if (ret_var.is_owned) {
5491 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5492 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5493 for (size_t i = 0; i < ret.datalen; i++) {
5494 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5498 typedef struct LDKWatch_JCalls {
5499 atomic_size_t refcnt;
5502 jmethodID watch_channel_meth;
5503 jmethodID update_channel_meth;
5504 jmethodID release_pending_monitor_events_meth;
5506 static void LDKWatch_JCalls_free(void* this_arg) {
5507 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5508 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5510 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5511 if (get_jenv_res == JNI_EDETACHED) {
5512 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5514 DO_ASSERT(get_jenv_res == JNI_OK);
5516 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5517 if (get_jenv_res == JNI_EDETACHED) {
5518 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5523 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5524 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5526 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5527 if (get_jenv_res == JNI_EDETACHED) {
5528 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5530 DO_ASSERT(get_jenv_res == JNI_OK);
5532 LDKOutPoint funding_txo_var = funding_txo;
5533 int64_t funding_txo_ref = 0;
5534 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5535 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5536 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5537 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5538 if (funding_txo_var.is_owned) {
5539 funding_txo_ref |= 1;
5541 LDKChannelMonitor monitor_var = monitor;
5542 int64_t monitor_ref = 0;
5543 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5544 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5545 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5546 monitor_ref = (uintptr_t)monitor_var.inner;
5547 if (monitor_var.is_owned) {
5550 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5552 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
5553 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5554 (*env)->ExceptionDescribe(env);
5555 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
5557 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5558 CHECK_ACCESS(ret_ptr);
5559 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5561 if (get_jenv_res == JNI_EDETACHED) {
5562 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5566 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5567 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5569 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5570 if (get_jenv_res == JNI_EDETACHED) {
5571 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5573 DO_ASSERT(get_jenv_res == JNI_OK);
5575 LDKOutPoint funding_txo_var = funding_txo;
5576 int64_t funding_txo_ref = 0;
5577 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5578 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5579 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5580 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5581 if (funding_txo_var.is_owned) {
5582 funding_txo_ref |= 1;
5584 LDKChannelMonitorUpdate update_var = update;
5585 int64_t update_ref = 0;
5586 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5587 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5588 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5589 update_ref = (uintptr_t)update_var.inner;
5590 if (update_var.is_owned) {
5593 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5595 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
5596 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5597 (*env)->ExceptionDescribe(env);
5598 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
5600 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5601 CHECK_ACCESS(ret_ptr);
5602 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5604 if (get_jenv_res == JNI_EDETACHED) {
5605 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5609 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5610 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5612 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5613 if (get_jenv_res == JNI_EDETACHED) {
5614 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5616 DO_ASSERT(get_jenv_res == JNI_OK);
5618 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5620 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
5621 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5622 (*env)->ExceptionDescribe(env);
5623 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
5625 LDKCVec_MonitorEventZ ret_constr;
5626 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5627 if (ret_constr.datalen > 0)
5628 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5630 ret_constr.data = NULL;
5631 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5632 for (size_t o = 0; o < ret_constr.datalen; o++) {
5633 int64_t ret_conv_14 = ret_vals[o];
5634 void* ret_conv_14_ptr = (void*)(((uintptr_t)ret_conv_14) & ~1);
5635 CHECK_ACCESS(ret_conv_14_ptr);
5636 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
5637 FREE((void*)ret_conv_14);
5638 ret_constr.data[o] = ret_conv_14_conv;
5640 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5641 if (get_jenv_res == JNI_EDETACHED) {
5642 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5646 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5647 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5648 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5650 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
5651 jclass c = (*env)->GetObjectClass(env, o);
5653 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5654 atomic_init(&calls->refcnt, 1);
5655 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5656 calls->o = (*env)->NewWeakGlobalRef(env, o);
5657 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
5658 CHECK(calls->watch_channel_meth != NULL);
5659 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
5660 CHECK(calls->update_channel_meth != NULL);
5661 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
5662 CHECK(calls->release_pending_monitor_events_meth != NULL);
5665 .this_arg = (void*) calls,
5666 .watch_channel = watch_channel_LDKWatch_jcall,
5667 .update_channel = update_channel_LDKWatch_jcall,
5668 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5669 .free = LDKWatch_JCalls_free,
5673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
5674 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5675 *res_ptr = LDKWatch_init(env, clz, o);
5676 return (uint64_t)res_ptr;
5678 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) {
5679 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5680 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5681 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5682 LDKOutPoint funding_txo_conv;
5683 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5684 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5685 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5686 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5687 LDKChannelMonitor monitor_conv;
5688 monitor_conv.inner = (void*)(monitor & (~1));
5689 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5690 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5691 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5692 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5693 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5694 return (int64_t)ret_conv;
5697 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) {
5698 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5699 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5700 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5701 LDKOutPoint funding_txo_conv;
5702 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5703 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5704 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5705 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5706 LDKChannelMonitorUpdate update_conv;
5707 update_conv.inner = (void*)(update & (~1));
5708 update_conv.is_owned = (update & 1) || (update == 0);
5709 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5710 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5711 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5712 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5713 return (int64_t)ret_conv;
5716 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
5717 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5718 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5719 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5720 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5721 int64_tArray ret_arr = NULL;
5722 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5723 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5724 for (size_t o = 0; o < ret_var.datalen; o++) {
5725 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5726 *ret_conv_14_copy = ret_var.data[o];
5727 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
5728 ret_arr_ptr[o] = ret_conv_14_ref;
5730 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5735 typedef struct LDKBroadcasterInterface_JCalls {
5736 atomic_size_t refcnt;
5739 jmethodID broadcast_transaction_meth;
5740 } LDKBroadcasterInterface_JCalls;
5741 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5742 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5743 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5745 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5746 if (get_jenv_res == JNI_EDETACHED) {
5747 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5749 DO_ASSERT(get_jenv_res == JNI_OK);
5751 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5752 if (get_jenv_res == JNI_EDETACHED) {
5753 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5758 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5759 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5761 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5762 if (get_jenv_res == JNI_EDETACHED) {
5763 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5765 DO_ASSERT(get_jenv_res == JNI_OK);
5767 LDKTransaction tx_var = tx;
5768 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
5769 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
5770 Transaction_free(tx_var);
5771 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5773 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
5774 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5775 (*env)->ExceptionDescribe(env);
5776 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
5778 if (get_jenv_res == JNI_EDETACHED) {
5779 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5782 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5783 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5784 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5786 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
5787 jclass c = (*env)->GetObjectClass(env, o);
5789 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5790 atomic_init(&calls->refcnt, 1);
5791 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5792 calls->o = (*env)->NewWeakGlobalRef(env, o);
5793 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
5794 CHECK(calls->broadcast_transaction_meth != NULL);
5796 LDKBroadcasterInterface ret = {
5797 .this_arg = (void*) calls,
5798 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5799 .free = LDKBroadcasterInterface_JCalls_free,
5803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
5804 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5805 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
5806 return (uint64_t)res_ptr;
5808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
5809 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5810 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5811 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5812 LDKTransaction tx_ref;
5813 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
5814 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5815 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
5816 tx_ref.data_is_owned = true;
5817 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5820 typedef struct LDKKeysInterface_JCalls {
5821 atomic_size_t refcnt;
5824 jmethodID get_node_secret_meth;
5825 jmethodID get_destination_script_meth;
5826 jmethodID get_shutdown_scriptpubkey_meth;
5827 jmethodID get_channel_signer_meth;
5828 jmethodID get_secure_random_bytes_meth;
5829 jmethodID read_chan_signer_meth;
5830 jmethodID sign_invoice_meth;
5831 jmethodID get_inbound_payment_key_material_meth;
5832 } LDKKeysInterface_JCalls;
5833 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5834 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5835 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5837 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5838 if (get_jenv_res == JNI_EDETACHED) {
5839 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5841 DO_ASSERT(get_jenv_res == JNI_OK);
5843 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5844 if (get_jenv_res == JNI_EDETACHED) {
5845 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5850 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5851 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5853 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5854 if (get_jenv_res == JNI_EDETACHED) {
5855 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5857 DO_ASSERT(get_jenv_res == JNI_OK);
5859 jclass recipient_conv = LDKRecipient_to_java(env, recipient);
5860 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5862 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
5863 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5864 (*env)->ExceptionDescribe(env);
5865 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
5867 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5868 CHECK_ACCESS(ret_ptr);
5869 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5871 if (get_jenv_res == JNI_EDETACHED) {
5872 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5876 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5877 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5879 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5880 if (get_jenv_res == JNI_EDETACHED) {
5881 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5883 DO_ASSERT(get_jenv_res == JNI_OK);
5885 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5887 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
5888 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5889 (*env)->ExceptionDescribe(env);
5890 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
5892 LDKCVec_u8Z ret_ref;
5893 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5894 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5895 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5896 if (get_jenv_res == JNI_EDETACHED) {
5897 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5901 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5902 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5904 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5905 if (get_jenv_res == JNI_EDETACHED) {
5906 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5908 DO_ASSERT(get_jenv_res == JNI_OK);
5910 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5912 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
5913 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5914 (*env)->ExceptionDescribe(env);
5915 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
5917 LDKShutdownScript ret_conv;
5918 ret_conv.inner = (void*)(ret & (~1));
5919 ret_conv.is_owned = (ret & 1) || (ret == 0);
5920 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5921 if (get_jenv_res == JNI_EDETACHED) {
5922 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5926 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5927 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5929 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5930 if (get_jenv_res == JNI_EDETACHED) {
5931 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5933 DO_ASSERT(get_jenv_res == JNI_OK);
5935 jboolean inbound_conv = inbound;
5936 int64_t channel_value_satoshis_conv = channel_value_satoshis;
5937 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5939 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound_conv, channel_value_satoshis_conv);
5940 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5941 (*env)->ExceptionDescribe(env);
5942 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
5944 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5945 CHECK_ACCESS(ret_ptr);
5946 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5948 if (get_jenv_res == JNI_EDETACHED) {
5949 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5953 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5954 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5956 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5957 if (get_jenv_res == JNI_EDETACHED) {
5958 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5960 DO_ASSERT(get_jenv_res == JNI_OK);
5962 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5964 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
5965 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5966 (*env)->ExceptionDescribe(env);
5967 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
5969 LDKThirtyTwoBytes ret_ref;
5970 CHECK((*env)->GetArrayLength(env, ret) == 32);
5971 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5972 if (get_jenv_res == JNI_EDETACHED) {
5973 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5977 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5978 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5980 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5981 if (get_jenv_res == JNI_EDETACHED) {
5982 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5984 DO_ASSERT(get_jenv_res == JNI_OK);
5986 LDKu8slice reader_var = reader;
5987 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
5988 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
5989 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5991 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
5992 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5993 (*env)->ExceptionDescribe(env);
5994 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
5996 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5997 CHECK_ACCESS(ret_ptr);
5998 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
6000 if (get_jenv_res == JNI_EDETACHED) {
6001 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6005 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
6006 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6008 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6009 if (get_jenv_res == JNI_EDETACHED) {
6010 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6012 DO_ASSERT(get_jenv_res == JNI_OK);
6014 LDKu8slice hrp_bytes_var = hrp_bytes;
6015 int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
6016 (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
6017 LDKCVec_u5Z invoice_data_var = invoice_data;
6018 jobjectArray invoice_data_arr = NULL;
6019 invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
6020 int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
6021 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6022 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6023 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6025 (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
6026 FREE(invoice_data_var.data);
6027 jclass receipient_conv = LDKRecipient_to_java(env, receipient);
6028 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6030 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
6031 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6032 (*env)->ExceptionDescribe(env);
6033 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
6035 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
6036 CHECK_ACCESS(ret_ptr);
6037 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6039 if (get_jenv_res == JNI_EDETACHED) {
6040 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6044 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
6045 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
6047 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6048 if (get_jenv_res == JNI_EDETACHED) {
6049 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6051 DO_ASSERT(get_jenv_res == JNI_OK);
6053 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6055 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
6056 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6057 (*env)->ExceptionDescribe(env);
6058 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
6060 LDKThirtyTwoBytes ret_ref;
6061 CHECK((*env)->GetArrayLength(env, ret) == 32);
6062 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
6063 if (get_jenv_res == JNI_EDETACHED) {
6064 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6068 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6069 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6070 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6072 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
6073 jclass c = (*env)->GetObjectClass(env, o);
6075 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6076 atomic_init(&calls->refcnt, 1);
6077 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6078 calls->o = (*env)->NewWeakGlobalRef(env, o);
6079 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
6080 CHECK(calls->get_node_secret_meth != NULL);
6081 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
6082 CHECK(calls->get_destination_script_meth != NULL);
6083 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
6084 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
6085 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
6086 CHECK(calls->get_channel_signer_meth != NULL);
6087 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
6088 CHECK(calls->get_secure_random_bytes_meth != NULL);
6089 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
6090 CHECK(calls->read_chan_signer_meth != NULL);
6091 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
6092 CHECK(calls->sign_invoice_meth != NULL);
6093 calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
6094 CHECK(calls->get_inbound_payment_key_material_meth != NULL);
6096 LDKKeysInterface ret = {
6097 .this_arg = (void*) calls,
6098 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6099 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6100 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6101 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6102 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6103 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6104 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6105 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6106 .free = LDKKeysInterface_JCalls_free,
6110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6111 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6112 *res_ptr = LDKKeysInterface_init(env, clz, o);
6113 return (uint64_t)res_ptr;
6115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
6116 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6117 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6118 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6119 LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
6120 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
6121 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
6122 return (int64_t)ret_conv;
6125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
6126 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6127 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6128 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6129 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6130 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6131 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6132 CVec_u8Z_free(ret_var);
6136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
6137 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6138 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6139 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6140 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6141 int64_t ret_ref = 0;
6142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6145 ret_ref = (uintptr_t)ret_var.inner;
6146 if (ret_var.is_owned) {
6152 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) {
6153 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6154 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6155 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6156 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6157 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6158 return (int64_t)ret_ret;
6161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
6162 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6163 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6164 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6165 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6166 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
6170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
6171 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6172 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6173 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6174 LDKu8slice reader_ref;
6175 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
6176 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
6177 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6178 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6179 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
6180 return (int64_t)ret_conv;
6183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray hrp_bytes, jobjectArray invoice_data, jclass receipient) {
6184 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6185 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6186 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6187 LDKu8slice hrp_bytes_ref;
6188 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
6189 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
6190 LDKCVec_u5Z invoice_data_constr;
6191 invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
6192 if (invoice_data_constr.datalen > 0)
6193 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
6195 invoice_data_constr.data = NULL;
6196 int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
6197 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6198 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6200 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
6202 (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
6203 LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
6204 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6205 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
6206 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
6207 return (int64_t)ret_conv;
6210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
6211 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6212 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6213 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6214 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6215 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
6219 typedef struct LDKFeeEstimator_JCalls {
6220 atomic_size_t refcnt;
6223 jmethodID get_est_sat_per_1000_weight_meth;
6224 } LDKFeeEstimator_JCalls;
6225 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6226 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6227 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6229 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6230 if (get_jenv_res == JNI_EDETACHED) {
6231 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6233 DO_ASSERT(get_jenv_res == JNI_OK);
6235 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6236 if (get_jenv_res == JNI_EDETACHED) {
6237 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6242 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6243 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6245 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6246 if (get_jenv_res == JNI_EDETACHED) {
6247 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6249 DO_ASSERT(get_jenv_res == JNI_OK);
6251 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
6252 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6254 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
6255 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6256 (*env)->ExceptionDescribe(env);
6257 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
6259 if (get_jenv_res == JNI_EDETACHED) {
6260 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6264 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6265 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6266 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6268 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
6269 jclass c = (*env)->GetObjectClass(env, o);
6271 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6272 atomic_init(&calls->refcnt, 1);
6273 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6274 calls->o = (*env)->NewWeakGlobalRef(env, o);
6275 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
6276 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
6278 LDKFeeEstimator ret = {
6279 .this_arg = (void*) calls,
6280 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6281 .free = LDKFeeEstimator_JCalls_free,
6285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
6286 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6287 *res_ptr = LDKFeeEstimator_init(env, clz, o);
6288 return (uint64_t)res_ptr;
6290 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) {
6291 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6292 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6293 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6294 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
6295 int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6299 typedef struct LDKLogger_JCalls {
6300 atomic_size_t refcnt;
6305 static void LDKLogger_JCalls_free(void* this_arg) {
6306 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6307 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6309 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6310 if (get_jenv_res == JNI_EDETACHED) {
6311 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6313 DO_ASSERT(get_jenv_res == JNI_OK);
6315 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6316 if (get_jenv_res == JNI_EDETACHED) {
6317 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6322 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
6323 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6325 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6326 if (get_jenv_res == JNI_EDETACHED) {
6327 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6329 DO_ASSERT(get_jenv_res == JNI_OK);
6331 LDKRecord record_var = *record;
6332 int64_t record_ref = 0;
6333 record_var = Record_clone(&record_var);
6334 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6335 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6336 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
6337 record_ref = (uintptr_t)record_var.inner;
6338 if (record_var.is_owned) {
6341 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6343 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
6344 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6345 (*env)->ExceptionDescribe(env);
6346 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
6348 if (get_jenv_res == JNI_EDETACHED) {
6349 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6352 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
6353 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
6354 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6356 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
6357 jclass c = (*env)->GetObjectClass(env, o);
6359 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
6360 atomic_init(&calls->refcnt, 1);
6361 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6362 calls->o = (*env)->NewWeakGlobalRef(env, o);
6363 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
6364 CHECK(calls->log_meth != NULL);
6367 .this_arg = (void*) calls,
6368 .log = log_LDKLogger_jcall,
6369 .free = LDKLogger_JCalls_free,
6373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
6374 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
6375 *res_ptr = LDKLogger_init(env, clz, o);
6376 return (uint64_t)res_ptr;
6378 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6379 return ThirtyTwoBytes_clone(&owner->a);
6381 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6382 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6383 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6384 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
6388 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6392 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6393 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6394 int64_t ret_ref = 0;
6395 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6396 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6397 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6398 ret_ref = (uintptr_t)ret_var.inner & ~1;
6402 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6403 CHECK(owner->result_ok);
6404 return &*owner->contents.result;
6406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6407 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6408 int64_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
6412 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6413 CHECK(!owner->result_ok);
6414 return DecodeError_clone(&*owner->contents.err);
6416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6417 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6418 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6419 int64_t ret_ref = 0;
6420 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6421 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6422 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6423 ret_ref = (uintptr_t)ret_var.inner;
6424 if (ret_var.is_owned) {
6430 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6431 CHECK(owner->result_ok);
6432 return ChannelConfig_clone(&*owner->contents.result);
6434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6435 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
6436 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6437 int64_t ret_ref = 0;
6438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6441 ret_ref = (uintptr_t)ret_var.inner;
6442 if (ret_var.is_owned) {
6448 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6449 CHECK(!owner->result_ok);
6450 return DecodeError_clone(&*owner->contents.err);
6452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6453 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
6454 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6455 int64_t ret_ref = 0;
6456 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6457 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6459 ret_ref = (uintptr_t)ret_var.inner;
6460 if (ret_var.is_owned) {
6466 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6467 CHECK(owner->result_ok);
6468 return OutPoint_clone(&*owner->contents.result);
6470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6471 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
6472 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6473 int64_t ret_ref = 0;
6474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6477 ret_ref = (uintptr_t)ret_var.inner;
6478 if (ret_var.is_owned) {
6484 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6485 CHECK(!owner->result_ok);
6486 return DecodeError_clone(&*owner->contents.err);
6488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6489 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
6490 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6491 int64_t ret_ref = 0;
6492 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6493 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6494 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6495 ret_ref = (uintptr_t)ret_var.inner;
6496 if (ret_var.is_owned) {
6502 typedef struct LDKType_JCalls {
6503 atomic_size_t refcnt;
6506 jmethodID type_id_meth;
6507 jmethodID debug_str_meth;
6508 jmethodID write_meth;
6510 static void LDKType_JCalls_free(void* this_arg) {
6511 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6512 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6514 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6515 if (get_jenv_res == JNI_EDETACHED) {
6516 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6518 DO_ASSERT(get_jenv_res == JNI_OK);
6520 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6521 if (get_jenv_res == JNI_EDETACHED) {
6522 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6527 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6528 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6530 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6531 if (get_jenv_res == JNI_EDETACHED) {
6532 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6534 DO_ASSERT(get_jenv_res == JNI_OK);
6536 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6538 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
6539 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6540 (*env)->ExceptionDescribe(env);
6541 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
6543 if (get_jenv_res == JNI_EDETACHED) {
6544 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6548 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6549 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6551 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6552 if (get_jenv_res == JNI_EDETACHED) {
6553 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6555 DO_ASSERT(get_jenv_res == JNI_OK);
6557 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6559 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
6560 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6561 (*env)->ExceptionDescribe(env);
6562 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
6564 LDKStr ret_conv = java_to_owned_str(env, ret);
6565 if (get_jenv_res == JNI_EDETACHED) {
6566 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6570 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6571 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6573 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6574 if (get_jenv_res == JNI_EDETACHED) {
6575 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6577 DO_ASSERT(get_jenv_res == JNI_OK);
6579 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6581 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
6582 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6583 (*env)->ExceptionDescribe(env);
6584 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
6586 LDKCVec_u8Z ret_ref;
6587 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6588 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6589 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6590 if (get_jenv_res == JNI_EDETACHED) {
6591 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6595 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6596 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6597 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6599 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
6600 jclass c = (*env)->GetObjectClass(env, o);
6602 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6603 atomic_init(&calls->refcnt, 1);
6604 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6605 calls->o = (*env)->NewWeakGlobalRef(env, o);
6606 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
6607 CHECK(calls->type_id_meth != NULL);
6608 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
6609 CHECK(calls->debug_str_meth != NULL);
6610 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
6611 CHECK(calls->write_meth != NULL);
6614 .this_arg = (void*) calls,
6615 .type_id = type_id_LDKType_jcall,
6616 .debug_str = debug_str_LDKType_jcall,
6617 .write = write_LDKType_jcall,
6618 .cloned = LDKType_JCalls_cloned,
6619 .free = LDKType_JCalls_free,
6623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
6624 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6625 *res_ptr = LDKType_init(env, clz, o);
6626 return (uint64_t)res_ptr;
6628 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
6629 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6630 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6631 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6632 int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6636 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
6637 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6638 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6639 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6640 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6641 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
6646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
6647 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6648 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6649 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6650 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6651 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6652 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6653 CVec_u8Z_free(ret_var);
6657 static jclass LDKCOption_TypeZ_Some_class = NULL;
6658 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
6659 static jclass LDKCOption_TypeZ_None_class = NULL;
6660 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
6661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
6662 LDKCOption_TypeZ_Some_class =
6663 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
6664 CHECK(LDKCOption_TypeZ_Some_class != NULL);
6665 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
6666 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
6667 LDKCOption_TypeZ_None_class =
6668 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
6669 CHECK(LDKCOption_TypeZ_None_class != NULL);
6670 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
6671 CHECK(LDKCOption_TypeZ_None_meth != NULL);
6673 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6674 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
6676 case LDKCOption_TypeZ_Some: {
6677 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6678 *some_ret = Type_clone(&obj->some);
6679 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (int64_t)some_ret);
6681 case LDKCOption_TypeZ_None: {
6682 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
6687 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6688 CHECK(owner->result_ok);
6689 return COption_TypeZ_clone(&*owner->contents.result);
6691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6692 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6693 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6694 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6695 int64_t ret_ref = (uintptr_t)ret_copy;
6699 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6700 CHECK(!owner->result_ok);
6701 return DecodeError_clone(&*owner->contents.err);
6703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6704 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6705 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6706 int64_t ret_ref = 0;
6707 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6708 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6710 ret_ref = (uintptr_t)ret_var.inner;
6711 if (ret_var.is_owned) {
6717 static jclass LDKPaymentError_Invoice_class = NULL;
6718 static jmethodID LDKPaymentError_Invoice_meth = NULL;
6719 static jclass LDKPaymentError_Routing_class = NULL;
6720 static jmethodID LDKPaymentError_Routing_meth = NULL;
6721 static jclass LDKPaymentError_Sending_class = NULL;
6722 static jmethodID LDKPaymentError_Sending_meth = NULL;
6723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
6724 LDKPaymentError_Invoice_class =
6725 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
6726 CHECK(LDKPaymentError_Invoice_class != NULL);
6727 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
6728 CHECK(LDKPaymentError_Invoice_meth != NULL);
6729 LDKPaymentError_Routing_class =
6730 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
6731 CHECK(LDKPaymentError_Routing_class != NULL);
6732 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
6733 CHECK(LDKPaymentError_Routing_meth != NULL);
6734 LDKPaymentError_Sending_class =
6735 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
6736 CHECK(LDKPaymentError_Sending_class != NULL);
6737 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
6738 CHECK(LDKPaymentError_Sending_meth != NULL);
6740 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6741 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
6743 case LDKPaymentError_Invoice: {
6744 LDKStr invoice_str = obj->invoice;
6745 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
6746 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
6748 case LDKPaymentError_Routing: {
6749 LDKLightningError routing_var = obj->routing;
6750 int64_t routing_ref = 0;
6751 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6752 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6753 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
6754 routing_ref = (uintptr_t)routing_var.inner & ~1;
6755 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
6757 case LDKPaymentError_Sending: {
6758 int64_t sending_ref = ((uintptr_t)&obj->sending) | 1;
6759 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
6764 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6765 CHECK(owner->result_ok);
6766 return ThirtyTwoBytes_clone(&*owner->contents.result);
6768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6769 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6770 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6771 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
6775 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6776 CHECK(!owner->result_ok);
6777 return PaymentError_clone(&*owner->contents.err);
6779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6780 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6781 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6782 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
6783 int64_t ret_ref = (uintptr_t)ret_copy;
6787 static jclass LDKParseError_Bech32Error_class = NULL;
6788 static jmethodID LDKParseError_Bech32Error_meth = NULL;
6789 static jclass LDKParseError_ParseAmountError_class = NULL;
6790 static jmethodID LDKParseError_ParseAmountError_meth = NULL;
6791 static jclass LDKParseError_MalformedSignature_class = NULL;
6792 static jmethodID LDKParseError_MalformedSignature_meth = NULL;
6793 static jclass LDKParseError_BadPrefix_class = NULL;
6794 static jmethodID LDKParseError_BadPrefix_meth = NULL;
6795 static jclass LDKParseError_UnknownCurrency_class = NULL;
6796 static jmethodID LDKParseError_UnknownCurrency_meth = NULL;
6797 static jclass LDKParseError_UnknownSiPrefix_class = NULL;
6798 static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL;
6799 static jclass LDKParseError_MalformedHRP_class = NULL;
6800 static jmethodID LDKParseError_MalformedHRP_meth = NULL;
6801 static jclass LDKParseError_TooShortDataPart_class = NULL;
6802 static jmethodID LDKParseError_TooShortDataPart_meth = NULL;
6803 static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL;
6804 static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL;
6805 static jclass LDKParseError_DescriptionDecodeError_class = NULL;
6806 static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL;
6807 static jclass LDKParseError_PaddingError_class = NULL;
6808 static jmethodID LDKParseError_PaddingError_meth = NULL;
6809 static jclass LDKParseError_IntegerOverflowError_class = NULL;
6810 static jmethodID LDKParseError_IntegerOverflowError_meth = NULL;
6811 static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL;
6812 static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL;
6813 static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL;
6814 static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL;
6815 static jclass LDKParseError_InvalidScriptHashLength_class = NULL;
6816 static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL;
6817 static jclass LDKParseError_InvalidRecoveryId_class = NULL;
6818 static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL;
6819 static jclass LDKParseError_InvalidSliceLength_class = NULL;
6820 static jmethodID LDKParseError_InvalidSliceLength_meth = NULL;
6821 static jclass LDKParseError_Skip_class = NULL;
6822 static jmethodID LDKParseError_Skip_meth = NULL;
6823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) {
6824 LDKParseError_Bech32Error_class =
6825 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error"));
6826 CHECK(LDKParseError_Bech32Error_class != NULL);
6827 LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "<init>", "(J)V");
6828 CHECK(LDKParseError_Bech32Error_meth != NULL);
6829 LDKParseError_ParseAmountError_class =
6830 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError"));
6831 CHECK(LDKParseError_ParseAmountError_class != NULL);
6832 LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "<init>", "(I)V");
6833 CHECK(LDKParseError_ParseAmountError_meth != NULL);
6834 LDKParseError_MalformedSignature_class =
6835 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature"));
6836 CHECK(LDKParseError_MalformedSignature_class != NULL);
6837 LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
6838 CHECK(LDKParseError_MalformedSignature_meth != NULL);
6839 LDKParseError_BadPrefix_class =
6840 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix"));
6841 CHECK(LDKParseError_BadPrefix_class != NULL);
6842 LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "<init>", "()V");
6843 CHECK(LDKParseError_BadPrefix_meth != NULL);
6844 LDKParseError_UnknownCurrency_class =
6845 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency"));
6846 CHECK(LDKParseError_UnknownCurrency_class != NULL);
6847 LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "<init>", "()V");
6848 CHECK(LDKParseError_UnknownCurrency_meth != NULL);
6849 LDKParseError_UnknownSiPrefix_class =
6850 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix"));
6851 CHECK(LDKParseError_UnknownSiPrefix_class != NULL);
6852 LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "<init>", "()V");
6853 CHECK(LDKParseError_UnknownSiPrefix_meth != NULL);
6854 LDKParseError_MalformedHRP_class =
6855 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP"));
6856 CHECK(LDKParseError_MalformedHRP_class != NULL);
6857 LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "<init>", "()V");
6858 CHECK(LDKParseError_MalformedHRP_meth != NULL);
6859 LDKParseError_TooShortDataPart_class =
6860 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart"));
6861 CHECK(LDKParseError_TooShortDataPart_class != NULL);
6862 LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "<init>", "()V");
6863 CHECK(LDKParseError_TooShortDataPart_meth != NULL);
6864 LDKParseError_UnexpectedEndOfTaggedFields_class =
6865 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields"));
6866 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL);
6867 LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
6868 CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL);
6869 LDKParseError_DescriptionDecodeError_class =
6870 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError"));
6871 CHECK(LDKParseError_DescriptionDecodeError_class != NULL);
6872 LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "<init>", "(I)V");
6873 CHECK(LDKParseError_DescriptionDecodeError_meth != NULL);
6874 LDKParseError_PaddingError_class =
6875 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError"));
6876 CHECK(LDKParseError_PaddingError_class != NULL);
6877 LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "<init>", "()V");
6878 CHECK(LDKParseError_PaddingError_meth != NULL);
6879 LDKParseError_IntegerOverflowError_class =
6880 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError"));
6881 CHECK(LDKParseError_IntegerOverflowError_class != NULL);
6882 LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "<init>", "()V");
6883 CHECK(LDKParseError_IntegerOverflowError_meth != NULL);
6884 LDKParseError_InvalidSegWitProgramLength_class =
6885 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength"));
6886 CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL);
6887 LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
6888 CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL);
6889 LDKParseError_InvalidPubKeyHashLength_class =
6890 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength"));
6891 CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL);
6892 LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
6893 CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL);
6894 LDKParseError_InvalidScriptHashLength_class =
6895 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength"));
6896 CHECK(LDKParseError_InvalidScriptHashLength_class != NULL);
6897 LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "<init>", "()V");
6898 CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL);
6899 LDKParseError_InvalidRecoveryId_class =
6900 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId"));
6901 CHECK(LDKParseError_InvalidRecoveryId_class != NULL);
6902 LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "<init>", "()V");
6903 CHECK(LDKParseError_InvalidRecoveryId_meth != NULL);
6904 LDKParseError_InvalidSliceLength_class =
6905 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength"));
6906 CHECK(LDKParseError_InvalidSliceLength_class != NULL);
6907 LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
6908 CHECK(LDKParseError_InvalidSliceLength_meth != NULL);
6909 LDKParseError_Skip_class =
6910 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip"));
6911 CHECK(LDKParseError_Skip_class != NULL);
6912 LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "<init>", "()V");
6913 CHECK(LDKParseError_Skip_meth != NULL);
6915 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6916 LDKParseError *obj = (LDKParseError*)(ptr & ~1);
6918 case LDKParseError_Bech32Error: {
6919 int64_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1;
6920 return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref);
6922 case LDKParseError_ParseAmountError: {
6923 /*obj->parse_amount_error*/
6924 return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0);
6926 case LDKParseError_MalformedSignature: {
6927 jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
6928 return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv);
6930 case LDKParseError_BadPrefix: {
6931 return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth);
6933 case LDKParseError_UnknownCurrency: {
6934 return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth);
6936 case LDKParseError_UnknownSiPrefix: {
6937 return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth);
6939 case LDKParseError_MalformedHRP: {
6940 return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth);
6942 case LDKParseError_TooShortDataPart: {
6943 return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth);
6945 case LDKParseError_UnexpectedEndOfTaggedFields: {
6946 return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth);
6948 case LDKParseError_DescriptionDecodeError: {
6949 /*obj->description_decode_error*/
6950 return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0);
6952 case LDKParseError_PaddingError: {
6953 return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth);
6955 case LDKParseError_IntegerOverflowError: {
6956 return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth);
6958 case LDKParseError_InvalidSegWitProgramLength: {
6959 return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth);
6961 case LDKParseError_InvalidPubKeyHashLength: {
6962 return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth);
6964 case LDKParseError_InvalidScriptHashLength: {
6965 return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth);
6967 case LDKParseError_InvalidRecoveryId: {
6968 return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth);
6970 case LDKParseError_InvalidSliceLength: {
6971 LDKStr invalid_slice_length_str = obj->invalid_slice_length;
6972 jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
6973 return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
6975 case LDKParseError_Skip: {
6976 return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth);
6981 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
6982 CHECK(owner->result_ok);
6983 return SiPrefix_clone(&*owner->contents.result);
6985 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6986 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
6987 jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
6991 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
6992 CHECK(!owner->result_ok);
6993 return ParseError_clone(&*owner->contents.err);
6995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6996 LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1);
6997 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
6998 *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
6999 int64_t ret_ref = (uintptr_t)ret_copy;
7003 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
7004 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
7005 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
7006 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
7007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
7008 LDKParseOrSemanticError_ParseError_class =
7009 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
7010 CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
7011 LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
7012 CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
7013 LDKParseOrSemanticError_SemanticError_class =
7014 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
7015 CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
7016 LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/SemanticError;)V");
7017 CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
7019 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7020 LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1);
7022 case LDKParseOrSemanticError_ParseError: {
7023 int64_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1;
7024 return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
7026 case LDKParseOrSemanticError_SemanticError: {
7027 jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error);
7028 return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
7033 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7034 CHECK(owner->result_ok);
7035 return Invoice_clone(&*owner->contents.result);
7037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7038 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7039 LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
7040 int64_t ret_ref = 0;
7041 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7042 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7043 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7044 ret_ref = (uintptr_t)ret_var.inner;
7045 if (ret_var.is_owned) {
7051 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
7052 CHECK(!owner->result_ok);
7053 return ParseOrSemanticError_clone(&*owner->contents.err);
7055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7056 LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1);
7057 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
7058 *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
7059 int64_t ret_ref = (uintptr_t)ret_copy;
7063 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7064 CHECK(owner->result_ok);
7065 return SignedRawInvoice_clone(&*owner->contents.result);
7067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7068 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7069 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
7070 int64_t ret_ref = 0;
7071 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7072 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7073 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7074 ret_ref = (uintptr_t)ret_var.inner;
7075 if (ret_var.is_owned) {
7081 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
7082 CHECK(!owner->result_ok);
7083 return ParseError_clone(&*owner->contents.err);
7085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7086 LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1);
7087 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
7088 *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
7089 int64_t ret_ref = (uintptr_t)ret_copy;
7093 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7094 return RawInvoice_clone(&owner->a);
7096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7097 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7098 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
7099 int64_t ret_ref = 0;
7100 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7101 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7103 ret_ref = (uintptr_t)ret_var.inner;
7104 if (ret_var.is_owned) {
7110 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7111 return ThirtyTwoBytes_clone(&owner->b);
7113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7114 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7115 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7116 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
7120 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
7121 return InvoiceSignature_clone(&owner->c);
7123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7124 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
7125 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
7126 int64_t ret_ref = 0;
7127 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7128 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7130 ret_ref = (uintptr_t)ret_var.inner;
7131 if (ret_var.is_owned) {
7137 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7138 CHECK(owner->result_ok);
7139 return PayeePubKey_clone(&*owner->contents.result);
7141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7142 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
7143 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
7144 int64_t ret_ref = 0;
7145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7148 ret_ref = (uintptr_t)ret_var.inner;
7149 if (ret_var.is_owned) {
7155 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
7156 CHECK(!owner->result_ok);
7157 return *owner->contents.err;
7159 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7160 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
7161 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
7165 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
7166 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
7167 for (size_t i = 0; i < ret.datalen; i++) {
7168 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
7172 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7173 CHECK(owner->result_ok);
7174 return PositiveTimestamp_clone(&*owner->contents.result);
7176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7177 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
7178 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
7179 int64_t ret_ref = 0;
7180 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7181 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7182 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7183 ret_ref = (uintptr_t)ret_var.inner;
7184 if (ret_var.is_owned) {
7190 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
7191 CHECK(!owner->result_ok);
7192 return CreationError_clone(&*owner->contents.err);
7194 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7195 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
7196 jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
7200 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7201 CHECK(owner->result_ok);
7202 return *owner->contents.result;
7204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7205 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
7206 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
7209 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
7210 CHECK(!owner->result_ok);
7211 return SemanticError_clone(&*owner->contents.err);
7213 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7214 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
7215 jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
7219 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7220 CHECK(owner->result_ok);
7221 return Invoice_clone(&*owner->contents.result);
7223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7224 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
7225 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
7226 int64_t ret_ref = 0;
7227 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7228 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7230 ret_ref = (uintptr_t)ret_var.inner;
7231 if (ret_var.is_owned) {
7237 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
7238 CHECK(!owner->result_ok);
7239 return SemanticError_clone(&*owner->contents.err);
7241 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7242 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
7243 jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
7247 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7248 CHECK(owner->result_ok);
7249 return Description_clone(&*owner->contents.result);
7251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7252 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
7253 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
7254 int64_t ret_ref = 0;
7255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7258 ret_ref = (uintptr_t)ret_var.inner;
7259 if (ret_var.is_owned) {
7265 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
7266 CHECK(!owner->result_ok);
7267 return CreationError_clone(&*owner->contents.err);
7269 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7270 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
7271 jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
7275 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7276 CHECK(owner->result_ok);
7277 return PrivateRoute_clone(&*owner->contents.result);
7279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7280 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
7281 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
7282 int64_t ret_ref = 0;
7283 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7284 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7285 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7286 ret_ref = (uintptr_t)ret_var.inner;
7287 if (ret_var.is_owned) {
7293 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
7294 CHECK(!owner->result_ok);
7295 return CreationError_clone(&*owner->contents.err);
7297 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7298 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
7299 jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
7303 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7304 CHECK(owner->result_ok);
7305 return *owner->contents.result;
7307 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7308 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
7309 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
7310 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7314 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7315 CHECK(!owner->result_ok);
7316 return *owner->contents.err;
7318 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7319 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
7320 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
7324 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7325 CHECK(owner->result_ok);
7326 return ChannelMonitorUpdate_clone(&*owner->contents.result);
7328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7329 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
7330 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7331 int64_t ret_ref = 0;
7332 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7333 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7334 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7335 ret_ref = (uintptr_t)ret_var.inner;
7336 if (ret_var.is_owned) {
7342 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7343 CHECK(!owner->result_ok);
7344 return DecodeError_clone(&*owner->contents.err);
7346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7347 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
7348 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7349 int64_t ret_ref = 0;
7350 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7351 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7352 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7353 ret_ref = (uintptr_t)ret_var.inner;
7354 if (ret_var.is_owned) {
7360 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
7361 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
7362 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
7363 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
7364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
7365 LDKCOption_MonitorEventZ_Some_class =
7366 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
7367 CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
7368 LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
7369 CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
7370 LDKCOption_MonitorEventZ_None_class =
7371 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
7372 CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
7373 LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
7374 CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
7376 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7377 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
7379 case LDKCOption_MonitorEventZ_Some: {
7380 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
7381 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
7383 case LDKCOption_MonitorEventZ_None: {
7384 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
7389 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7390 CHECK(owner->result_ok);
7391 return COption_MonitorEventZ_clone(&*owner->contents.result);
7393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7394 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
7395 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7396 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7397 int64_t ret_ref = (uintptr_t)ret_copy;
7401 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7402 CHECK(!owner->result_ok);
7403 return DecodeError_clone(&*owner->contents.err);
7405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7406 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
7407 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7408 int64_t ret_ref = 0;
7409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7412 ret_ref = (uintptr_t)ret_var.inner;
7413 if (ret_var.is_owned) {
7419 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7420 CHECK(owner->result_ok);
7421 return HTLCUpdate_clone(&*owner->contents.result);
7423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7424 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
7425 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7426 int64_t ret_ref = 0;
7427 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7428 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7429 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7430 ret_ref = (uintptr_t)ret_var.inner;
7431 if (ret_var.is_owned) {
7437 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7438 CHECK(!owner->result_ok);
7439 return DecodeError_clone(&*owner->contents.err);
7441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7442 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
7443 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7444 int64_t ret_ref = 0;
7445 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7446 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7447 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7448 ret_ref = (uintptr_t)ret_var.inner;
7449 if (ret_var.is_owned) {
7455 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7456 return OutPoint_clone(&owner->a);
7458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7459 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
7460 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
7461 int64_t ret_ref = 0;
7462 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7463 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7464 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7465 ret_ref = (uintptr_t)ret_var.inner;
7466 if (ret_var.is_owned) {
7472 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7473 return CVec_u8Z_clone(&owner->b);
7475 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7476 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
7477 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
7478 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7479 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7480 CVec_u8Z_free(ret_var);
7484 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7487 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7488 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
7489 int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
7493 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7494 return CVec_u8Z_clone(&owner->b);
7496 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7497 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
7498 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
7499 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7500 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7501 CVec_u8Z_free(ret_var);
7505 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
7506 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
7507 for (size_t i = 0; i < ret.datalen; i++) {
7508 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
7512 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7513 return ThirtyTwoBytes_clone(&owner->a);
7515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7516 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
7517 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7518 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
7522 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7523 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
7525 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7526 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
7527 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
7528 int64_tArray ret_arr = NULL;
7529 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7530 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7531 for (size_t v = 0; v < ret_var.datalen; v++) {
7532 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7533 *ret_conv_21_conv = ret_var.data[v];
7534 ret_arr_ptr[v] = ((int64_t)ret_conv_21_conv);
7536 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7541 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
7542 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 };
7543 for (size_t i = 0; i < ret.datalen; i++) {
7544 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
7548 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
7549 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
7550 for (size_t i = 0; i < ret.datalen; i++) {
7551 ret.data[i] = Event_clone(&orig->data[i]);
7555 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7558 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7559 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
7560 int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
7564 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7565 return TxOut_clone(&owner->b);
7567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7568 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
7569 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7570 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7571 return (int64_t)ret_ref;
7574 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7575 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7576 for (size_t i = 0; i < ret.datalen; i++) {
7577 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7581 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7582 return ThirtyTwoBytes_clone(&owner->a);
7584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7585 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
7586 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7587 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
7591 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7592 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7594 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7595 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
7596 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7597 int64_tArray ret_arr = NULL;
7598 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7599 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7600 for (size_t u = 0; u < ret_var.datalen; u++) {
7601 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7602 *ret_conv_20_conv = ret_var.data[u];
7603 ret_arr_ptr[u] = ((int64_t)ret_conv_20_conv);
7605 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7610 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
7611 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 };
7612 for (size_t i = 0; i < ret.datalen; i++) {
7613 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7617 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
7618 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
7619 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
7620 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
7621 static jclass LDKBalance_ContentiousClaimable_class = NULL;
7622 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
7623 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
7624 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
7625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
7626 LDKBalance_ClaimableOnChannelClose_class =
7627 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
7628 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
7629 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
7630 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
7631 LDKBalance_ClaimableAwaitingConfirmations_class =
7632 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
7633 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
7634 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
7635 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
7636 LDKBalance_ContentiousClaimable_class =
7637 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
7638 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
7639 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
7640 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
7641 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
7642 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
7643 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
7644 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
7645 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
7647 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7648 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
7650 case LDKBalance_ClaimableOnChannelClose: {
7651 int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
7652 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, claimable_amount_satoshis_conv);
7654 case LDKBalance_ClaimableAwaitingConfirmations: {
7655 int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
7656 int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
7657 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, claimable_amount_satoshis_conv, confirmation_height_conv);
7659 case LDKBalance_ContentiousClaimable: {
7660 int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
7661 int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
7662 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, claimable_amount_satoshis_conv, timeout_height_conv);
7664 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
7665 int64_t claimable_amount_satoshis_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis;
7666 int32_t claimable_height_conv = obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
7667 return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, claimable_amount_satoshis_conv, claimable_height_conv);
7672 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7673 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7674 for (size_t i = 0; i < ret.datalen; i++) {
7675 ret.data[i] = Balance_clone(&orig->data[i]);
7679 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7680 CHECK(owner->result_ok);
7681 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
7683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7684 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
7685 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7686 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7687 return ((int64_t)ret_conv);
7690 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7691 CHECK(!owner->result_ok);
7692 return DecodeError_clone(&*owner->contents.err);
7694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7695 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
7696 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7697 int64_t ret_ref = 0;
7698 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7699 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7700 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7701 ret_ref = (uintptr_t)ret_var.inner;
7702 if (ret_var.is_owned) {
7708 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
7709 CHECK(owner->result_ok);
7710 return *owner->contents.result;
7712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7713 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
7714 CResult_NoneLightningErrorZ_get_ok(owner_conv);
7717 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
7718 CHECK(!owner->result_ok);
7719 return LightningError_clone(&*owner->contents.err);
7721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7722 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
7723 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
7724 int64_t ret_ref = 0;
7725 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7726 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7727 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7728 ret_ref = (uintptr_t)ret_var.inner;
7729 if (ret_var.is_owned) {
7735 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7739 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
7740 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7741 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
7745 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7746 return Type_clone(&owner->b);
7748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7749 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
7750 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
7751 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
7752 return (int64_t)ret_ret;
7755 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
7756 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
7757 for (size_t i = 0; i < ret.datalen; i++) {
7758 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
7762 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
7763 CHECK(owner->result_ok);
7764 return *owner->contents.result;
7766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7767 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
7768 jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
7772 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
7773 CHECK(!owner->result_ok);
7774 return LightningError_clone(&*owner->contents.err);
7776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7777 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
7778 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
7779 int64_t ret_ref = 0;
7780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7783 ret_ref = (uintptr_t)ret_var.inner;
7784 if (ret_var.is_owned) {
7790 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7791 return ChannelAnnouncement_clone(&owner->a);
7793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7794 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7795 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
7796 int64_t ret_ref = 0;
7797 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7798 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7799 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7800 ret_ref = (uintptr_t)ret_var.inner;
7801 if (ret_var.is_owned) {
7807 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7808 return ChannelUpdate_clone(&owner->b);
7810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7811 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7812 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
7813 int64_t ret_ref = 0;
7814 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7815 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7816 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7817 ret_ref = (uintptr_t)ret_var.inner;
7818 if (ret_var.is_owned) {
7824 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7825 return ChannelUpdate_clone(&owner->c);
7827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7828 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7829 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
7830 int64_t ret_ref = 0;
7831 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7832 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7833 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7834 ret_ref = (uintptr_t)ret_var.inner;
7835 if (ret_var.is_owned) {
7841 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
7842 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
7843 for (size_t i = 0; i < ret.datalen; i++) {
7844 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
7848 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
7849 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
7850 for (size_t i = 0; i < ret.datalen; i++) {
7851 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
7855 static jclass LDKCOption_NetAddressZ_Some_class = NULL;
7856 static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL;
7857 static jclass LDKCOption_NetAddressZ_None_class = NULL;
7858 static jmethodID LDKCOption_NetAddressZ_None_meth = NULL;
7859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) {
7860 LDKCOption_NetAddressZ_Some_class =
7861 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some"));
7862 CHECK(LDKCOption_NetAddressZ_Some_class != NULL);
7863 LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "<init>", "(J)V");
7864 CHECK(LDKCOption_NetAddressZ_Some_meth != NULL);
7865 LDKCOption_NetAddressZ_None_class =
7866 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None"));
7867 CHECK(LDKCOption_NetAddressZ_None_class != NULL);
7868 LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "<init>", "()V");
7869 CHECK(LDKCOption_NetAddressZ_None_meth != NULL);
7871 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7872 LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1);
7874 case LDKCOption_NetAddressZ_Some: {
7875 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
7876 return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref);
7878 case LDKCOption_NetAddressZ_None: {
7879 return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth);
7884 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7885 CHECK(owner->result_ok);
7886 return CVec_u8Z_clone(&*owner->contents.result);
7888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7889 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
7890 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7891 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7892 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7893 CVec_u8Z_free(ret_var);
7897 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7898 CHECK(!owner->result_ok);
7899 return PeerHandleError_clone(&*owner->contents.err);
7901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7902 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
7903 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7904 int64_t ret_ref = 0;
7905 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7906 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7907 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7908 ret_ref = (uintptr_t)ret_var.inner;
7909 if (ret_var.is_owned) {
7915 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7916 CHECK(owner->result_ok);
7917 return *owner->contents.result;
7919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7920 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
7921 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7924 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7925 CHECK(!owner->result_ok);
7926 return PeerHandleError_clone(&*owner->contents.err);
7928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7929 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
7930 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7931 int64_t ret_ref = 0;
7932 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7933 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7935 ret_ref = (uintptr_t)ret_var.inner;
7936 if (ret_var.is_owned) {
7942 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7943 CHECK(owner->result_ok);
7944 return *owner->contents.result;
7946 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7947 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
7948 jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7952 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7953 CHECK(!owner->result_ok);
7954 return PeerHandleError_clone(&*owner->contents.err);
7956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7957 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
7958 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7959 int64_t ret_ref = 0;
7960 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7961 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7963 ret_ref = (uintptr_t)ret_var.inner;
7964 if (ret_var.is_owned) {
7970 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
7971 CHECK(owner->result_ok);
7972 return NodeId_clone(&*owner->contents.result);
7974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7975 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
7976 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
7977 int64_t ret_ref = 0;
7978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7981 ret_ref = (uintptr_t)ret_var.inner;
7982 if (ret_var.is_owned) {
7988 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
7989 CHECK(!owner->result_ok);
7990 return DecodeError_clone(&*owner->contents.err);
7992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7993 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
7994 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
7995 int64_t ret_ref = 0;
7996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7999 ret_ref = (uintptr_t)ret_var.inner;
8000 if (ret_var.is_owned) {
8006 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
8007 CHECK(owner->result_ok);
8008 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
8010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8011 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
8012 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
8013 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
8014 int64_t ret_ref = (uintptr_t)ret_copy;
8018 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
8019 CHECK(!owner->result_ok);
8020 return DecodeError_clone(&*owner->contents.err);
8022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8023 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
8024 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
8025 int64_t ret_ref = 0;
8026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8029 ret_ref = (uintptr_t)ret_var.inner;
8030 if (ret_var.is_owned) {
8036 typedef struct LDKAccess_JCalls {
8037 atomic_size_t refcnt;
8040 jmethodID get_utxo_meth;
8042 static void LDKAccess_JCalls_free(void* this_arg) {
8043 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
8044 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8046 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8047 if (get_jenv_res == JNI_EDETACHED) {
8048 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8050 DO_ASSERT(get_jenv_res == JNI_OK);
8052 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8053 if (get_jenv_res == JNI_EDETACHED) {
8054 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8059 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
8060 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
8062 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8063 if (get_jenv_res == JNI_EDETACHED) {
8064 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8066 DO_ASSERT(get_jenv_res == JNI_OK);
8068 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
8069 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
8070 int64_t short_channel_id_conv = short_channel_id;
8071 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8073 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv);
8074 if (UNLIKELY((*env)->ExceptionCheck(env))) {
8075 (*env)->ExceptionDescribe(env);
8076 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
8078 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
8079 CHECK_ACCESS(ret_ptr);
8080 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
8082 if (get_jenv_res == JNI_EDETACHED) {
8083 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8087 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
8088 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
8089 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8091 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
8092 jclass c = (*env)->GetObjectClass(env, o);
8094 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
8095 atomic_init(&calls->refcnt, 1);
8096 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8097 calls->o = (*env)->NewWeakGlobalRef(env, o);
8098 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
8099 CHECK(calls->get_utxo_meth != NULL);
8102 .this_arg = (void*) calls,
8103 .get_utxo = get_utxo_LDKAccess_jcall,
8104 .free = LDKAccess_JCalls_free,
8108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
8109 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
8110 *res_ptr = LDKAccess_init(env, clz, o);
8111 return (uint64_t)res_ptr;
8113 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) {
8114 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
8115 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
8116 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
8117 unsigned char genesis_hash_arr[32];
8118 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
8119 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
8120 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
8121 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
8122 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
8123 return (int64_t)ret_conv;
8126 static jclass LDKCOption_AccessZ_Some_class = NULL;
8127 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
8128 static jclass LDKCOption_AccessZ_None_class = NULL;
8129 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
8130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
8131 LDKCOption_AccessZ_Some_class =
8132 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
8133 CHECK(LDKCOption_AccessZ_Some_class != NULL);
8134 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
8135 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
8136 LDKCOption_AccessZ_None_class =
8137 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
8138 CHECK(LDKCOption_AccessZ_None_class != NULL);
8139 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
8140 CHECK(LDKCOption_AccessZ_None_meth != NULL);
8142 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8143 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
8145 case LDKCOption_AccessZ_Some: {
8146 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
8147 *some_ret = obj->some;
8148 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8149 if ((*some_ret).free == LDKAccess_JCalls_free) {
8150 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8151 LDKAccess_JCalls_cloned(&(*some_ret));
8153 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (int64_t)some_ret);
8155 case LDKCOption_AccessZ_None: {
8156 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
8161 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
8162 CHECK(owner->result_ok);
8163 return ChannelUpdateInfo_clone(&*owner->contents.result);
8165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8166 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
8167 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
8168 int64_t ret_ref = 0;
8169 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8170 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8171 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8172 ret_ref = (uintptr_t)ret_var.inner;
8173 if (ret_var.is_owned) {
8179 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
8180 CHECK(!owner->result_ok);
8181 return DecodeError_clone(&*owner->contents.err);
8183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8184 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
8185 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
8186 int64_t ret_ref = 0;
8187 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8188 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8190 ret_ref = (uintptr_t)ret_var.inner;
8191 if (ret_var.is_owned) {
8197 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
8198 CHECK(owner->result_ok);
8199 return ChannelInfo_clone(&*owner->contents.result);
8201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8202 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
8203 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
8204 int64_t ret_ref = 0;
8205 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8206 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8207 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8208 ret_ref = (uintptr_t)ret_var.inner;
8209 if (ret_var.is_owned) {
8215 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
8216 CHECK(!owner->result_ok);
8217 return DecodeError_clone(&*owner->contents.err);
8219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8220 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
8221 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
8222 int64_t ret_ref = 0;
8223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8226 ret_ref = (uintptr_t)ret_var.inner;
8227 if (ret_var.is_owned) {
8233 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
8234 CHECK(owner->result_ok);
8235 return RoutingFees_clone(&*owner->contents.result);
8237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8238 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
8239 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
8240 int64_t ret_ref = 0;
8241 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8242 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8244 ret_ref = (uintptr_t)ret_var.inner;
8245 if (ret_var.is_owned) {
8251 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
8252 CHECK(!owner->result_ok);
8253 return DecodeError_clone(&*owner->contents.err);
8255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8256 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
8257 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
8258 int64_t ret_ref = 0;
8259 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8260 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8262 ret_ref = (uintptr_t)ret_var.inner;
8263 if (ret_var.is_owned) {
8269 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
8270 CHECK(owner->result_ok);
8271 return NodeAnnouncementInfo_clone(&*owner->contents.result);
8273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8274 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
8275 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
8276 int64_t ret_ref = 0;
8277 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8278 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8280 ret_ref = (uintptr_t)ret_var.inner;
8281 if (ret_var.is_owned) {
8287 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
8288 CHECK(!owner->result_ok);
8289 return DecodeError_clone(&*owner->contents.err);
8291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8292 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
8293 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
8294 int64_t ret_ref = 0;
8295 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8296 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8297 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8298 ret_ref = (uintptr_t)ret_var.inner;
8299 if (ret_var.is_owned) {
8305 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
8306 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
8307 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
8310 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
8311 CHECK(owner->result_ok);
8312 return NodeInfo_clone(&*owner->contents.result);
8314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8315 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
8316 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
8317 int64_t ret_ref = 0;
8318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8321 ret_ref = (uintptr_t)ret_var.inner;
8322 if (ret_var.is_owned) {
8328 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
8329 CHECK(!owner->result_ok);
8330 return DecodeError_clone(&*owner->contents.err);
8332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8333 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
8334 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
8335 int64_t ret_ref = 0;
8336 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8337 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8338 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8339 ret_ref = (uintptr_t)ret_var.inner;
8340 if (ret_var.is_owned) {
8346 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
8347 CHECK(owner->result_ok);
8348 return NetworkGraph_clone(&*owner->contents.result);
8350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8351 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
8352 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
8353 int64_t ret_ref = 0;
8354 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8355 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8357 ret_ref = (uintptr_t)ret_var.inner;
8358 if (ret_var.is_owned) {
8364 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
8365 CHECK(!owner->result_ok);
8366 return DecodeError_clone(&*owner->contents.err);
8368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8369 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
8370 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
8371 int64_t ret_ref = 0;
8372 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8373 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8375 ret_ref = (uintptr_t)ret_var.inner;
8376 if (ret_var.is_owned) {
8382 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
8383 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
8384 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
8385 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
8386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
8387 LDKCOption_CVec_NetAddressZZ_Some_class =
8388 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
8389 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
8390 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
8391 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
8392 LDKCOption_CVec_NetAddressZZ_None_class =
8393 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
8394 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
8395 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
8396 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
8398 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8399 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
8401 case LDKCOption_CVec_NetAddressZZ_Some: {
8402 LDKCVec_NetAddressZ some_var = obj->some;
8403 int64_tArray some_arr = NULL;
8404 some_arr = (*env)->NewLongArray(env, some_var.datalen);
8405 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
8406 for (size_t m = 0; m < some_var.datalen; m++) {
8407 int64_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
8408 some_arr_ptr[m] = some_conv_12_ref;
8410 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
8411 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
8413 case LDKCOption_CVec_NetAddressZZ_None: {
8414 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
8419 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8420 CHECK(owner->result_ok);
8421 return NetAddress_clone(&*owner->contents.result);
8423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8424 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8425 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8426 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8427 int64_t ret_ref = (uintptr_t)ret_copy;
8431 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8432 CHECK(!owner->result_ok);
8433 return DecodeError_clone(&*owner->contents.err);
8435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8436 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8437 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8438 int64_t ret_ref = 0;
8439 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8440 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8442 ret_ref = (uintptr_t)ret_var.inner;
8443 if (ret_var.is_owned) {
8449 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8450 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8451 for (size_t i = 0; i < ret.datalen; i++) {
8452 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8456 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8457 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8458 for (size_t i = 0; i < ret.datalen; i++) {
8459 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8463 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8464 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8465 for (size_t i = 0; i < ret.datalen; i++) {
8466 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8470 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8471 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8472 for (size_t i = 0; i < ret.datalen; i++) {
8473 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8477 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8478 CHECK(owner->result_ok);
8479 return AcceptChannel_clone(&*owner->contents.result);
8481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8482 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8483 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8484 int64_t ret_ref = 0;
8485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8488 ret_ref = (uintptr_t)ret_var.inner;
8489 if (ret_var.is_owned) {
8495 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8496 CHECK(!owner->result_ok);
8497 return DecodeError_clone(&*owner->contents.err);
8499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8500 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8501 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8502 int64_t ret_ref = 0;
8503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8506 ret_ref = (uintptr_t)ret_var.inner;
8507 if (ret_var.is_owned) {
8513 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8514 CHECK(owner->result_ok);
8515 return AnnouncementSignatures_clone(&*owner->contents.result);
8517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8518 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8519 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8520 int64_t ret_ref = 0;
8521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8524 ret_ref = (uintptr_t)ret_var.inner;
8525 if (ret_var.is_owned) {
8531 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8532 CHECK(!owner->result_ok);
8533 return DecodeError_clone(&*owner->contents.err);
8535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8536 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8537 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8538 int64_t ret_ref = 0;
8539 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8540 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8542 ret_ref = (uintptr_t)ret_var.inner;
8543 if (ret_var.is_owned) {
8549 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8550 CHECK(owner->result_ok);
8551 return ChannelReestablish_clone(&*owner->contents.result);
8553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8554 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8555 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8556 int64_t ret_ref = 0;
8557 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8558 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8559 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8560 ret_ref = (uintptr_t)ret_var.inner;
8561 if (ret_var.is_owned) {
8567 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8568 CHECK(!owner->result_ok);
8569 return DecodeError_clone(&*owner->contents.err);
8571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8572 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8573 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8574 int64_t ret_ref = 0;
8575 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8576 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8578 ret_ref = (uintptr_t)ret_var.inner;
8579 if (ret_var.is_owned) {
8585 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8586 CHECK(owner->result_ok);
8587 return ClosingSigned_clone(&*owner->contents.result);
8589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8590 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8591 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8592 int64_t ret_ref = 0;
8593 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8594 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8595 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8596 ret_ref = (uintptr_t)ret_var.inner;
8597 if (ret_var.is_owned) {
8603 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8604 CHECK(!owner->result_ok);
8605 return DecodeError_clone(&*owner->contents.err);
8607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8608 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8609 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
8610 int64_t ret_ref = 0;
8611 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8612 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8613 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8614 ret_ref = (uintptr_t)ret_var.inner;
8615 if (ret_var.is_owned) {
8621 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8622 CHECK(owner->result_ok);
8623 return ClosingSignedFeeRange_clone(&*owner->contents.result);
8625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8626 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8627 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
8628 int64_t ret_ref = 0;
8629 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8630 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8631 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8632 ret_ref = (uintptr_t)ret_var.inner;
8633 if (ret_var.is_owned) {
8639 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8640 CHECK(!owner->result_ok);
8641 return DecodeError_clone(&*owner->contents.err);
8643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8644 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8645 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
8646 int64_t ret_ref = 0;
8647 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8648 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8650 ret_ref = (uintptr_t)ret_var.inner;
8651 if (ret_var.is_owned) {
8657 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8658 CHECK(owner->result_ok);
8659 return CommitmentSigned_clone(&*owner->contents.result);
8661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8662 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8663 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
8664 int64_t ret_ref = 0;
8665 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8666 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8667 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8668 ret_ref = (uintptr_t)ret_var.inner;
8669 if (ret_var.is_owned) {
8675 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8676 CHECK(!owner->result_ok);
8677 return DecodeError_clone(&*owner->contents.err);
8679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8680 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8681 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
8682 int64_t ret_ref = 0;
8683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8686 ret_ref = (uintptr_t)ret_var.inner;
8687 if (ret_var.is_owned) {
8693 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8694 CHECK(owner->result_ok);
8695 return FundingCreated_clone(&*owner->contents.result);
8697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8698 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8699 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
8700 int64_t ret_ref = 0;
8701 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8702 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8703 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8704 ret_ref = (uintptr_t)ret_var.inner;
8705 if (ret_var.is_owned) {
8711 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8712 CHECK(!owner->result_ok);
8713 return DecodeError_clone(&*owner->contents.err);
8715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8716 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8717 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
8718 int64_t ret_ref = 0;
8719 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8720 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8721 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8722 ret_ref = (uintptr_t)ret_var.inner;
8723 if (ret_var.is_owned) {
8729 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8730 CHECK(owner->result_ok);
8731 return FundingSigned_clone(&*owner->contents.result);
8733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8734 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8735 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
8736 int64_t ret_ref = 0;
8737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8740 ret_ref = (uintptr_t)ret_var.inner;
8741 if (ret_var.is_owned) {
8747 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8748 CHECK(!owner->result_ok);
8749 return DecodeError_clone(&*owner->contents.err);
8751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8752 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8753 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
8754 int64_t ret_ref = 0;
8755 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8756 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8757 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8758 ret_ref = (uintptr_t)ret_var.inner;
8759 if (ret_var.is_owned) {
8765 static inline struct LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
8766 CHECK(owner->result_ok);
8767 return FundingLocked_clone(&*owner->contents.result);
8769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8770 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
8771 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_get_ok(owner_conv);
8772 int64_t ret_ref = 0;
8773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8776 ret_ref = (uintptr_t)ret_var.inner;
8777 if (ret_var.is_owned) {
8783 static inline struct LDKDecodeError CResult_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
8784 CHECK(!owner->result_ok);
8785 return DecodeError_clone(&*owner->contents.err);
8787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8788 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
8789 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_get_err(owner_conv);
8790 int64_t ret_ref = 0;
8791 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8792 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8793 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8794 ret_ref = (uintptr_t)ret_var.inner;
8795 if (ret_var.is_owned) {
8801 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8802 CHECK(owner->result_ok);
8803 return Init_clone(&*owner->contents.result);
8805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8806 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
8807 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8808 int64_t ret_ref = 0;
8809 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8810 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8811 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8812 ret_ref = (uintptr_t)ret_var.inner;
8813 if (ret_var.is_owned) {
8819 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8820 CHECK(!owner->result_ok);
8821 return DecodeError_clone(&*owner->contents.err);
8823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8824 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
8825 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
8826 int64_t ret_ref = 0;
8827 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8828 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8830 ret_ref = (uintptr_t)ret_var.inner;
8831 if (ret_var.is_owned) {
8837 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8838 CHECK(owner->result_ok);
8839 return OpenChannel_clone(&*owner->contents.result);
8841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8842 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8843 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8844 int64_t ret_ref = 0;
8845 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8846 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8848 ret_ref = (uintptr_t)ret_var.inner;
8849 if (ret_var.is_owned) {
8855 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8856 CHECK(!owner->result_ok);
8857 return DecodeError_clone(&*owner->contents.err);
8859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8860 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8861 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8862 int64_t ret_ref = 0;
8863 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8864 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8865 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8866 ret_ref = (uintptr_t)ret_var.inner;
8867 if (ret_var.is_owned) {
8873 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8874 CHECK(owner->result_ok);
8875 return RevokeAndACK_clone(&*owner->contents.result);
8877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8878 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8879 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8880 int64_t ret_ref = 0;
8881 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8882 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8884 ret_ref = (uintptr_t)ret_var.inner;
8885 if (ret_var.is_owned) {
8891 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8892 CHECK(!owner->result_ok);
8893 return DecodeError_clone(&*owner->contents.err);
8895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8896 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8897 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8898 int64_t ret_ref = 0;
8899 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8900 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8901 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8902 ret_ref = (uintptr_t)ret_var.inner;
8903 if (ret_var.is_owned) {
8909 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8910 CHECK(owner->result_ok);
8911 return Shutdown_clone(&*owner->contents.result);
8913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8914 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
8915 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8916 int64_t ret_ref = 0;
8917 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8918 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8919 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8920 ret_ref = (uintptr_t)ret_var.inner;
8921 if (ret_var.is_owned) {
8927 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8928 CHECK(!owner->result_ok);
8929 return DecodeError_clone(&*owner->contents.err);
8931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8932 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
8933 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8934 int64_t ret_ref = 0;
8935 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8936 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8937 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8938 ret_ref = (uintptr_t)ret_var.inner;
8939 if (ret_var.is_owned) {
8945 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8946 CHECK(owner->result_ok);
8947 return UpdateFailHTLC_clone(&*owner->contents.result);
8949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8950 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
8951 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8952 int64_t ret_ref = 0;
8953 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8954 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8955 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8956 ret_ref = (uintptr_t)ret_var.inner;
8957 if (ret_var.is_owned) {
8963 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8964 CHECK(!owner->result_ok);
8965 return DecodeError_clone(&*owner->contents.err);
8967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8968 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
8969 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8970 int64_t ret_ref = 0;
8971 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8972 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8974 ret_ref = (uintptr_t)ret_var.inner;
8975 if (ret_var.is_owned) {
8981 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8982 CHECK(owner->result_ok);
8983 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
8985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8986 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
8987 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8988 int64_t ret_ref = 0;
8989 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8990 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8991 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8992 ret_ref = (uintptr_t)ret_var.inner;
8993 if (ret_var.is_owned) {
8999 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9000 CHECK(!owner->result_ok);
9001 return DecodeError_clone(&*owner->contents.err);
9003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9004 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
9005 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9006 int64_t ret_ref = 0;
9007 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9008 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9009 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9010 ret_ref = (uintptr_t)ret_var.inner;
9011 if (ret_var.is_owned) {
9017 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9018 CHECK(owner->result_ok);
9019 return UpdateFee_clone(&*owner->contents.result);
9021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9022 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
9023 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9024 int64_t ret_ref = 0;
9025 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9026 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9027 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9028 ret_ref = (uintptr_t)ret_var.inner;
9029 if (ret_var.is_owned) {
9035 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9036 CHECK(!owner->result_ok);
9037 return DecodeError_clone(&*owner->contents.err);
9039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9040 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
9041 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9042 int64_t ret_ref = 0;
9043 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9044 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9045 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9046 ret_ref = (uintptr_t)ret_var.inner;
9047 if (ret_var.is_owned) {
9053 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9054 CHECK(owner->result_ok);
9055 return UpdateFulfillHTLC_clone(&*owner->contents.result);
9057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9058 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9059 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9060 int64_t ret_ref = 0;
9061 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9062 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9064 ret_ref = (uintptr_t)ret_var.inner;
9065 if (ret_var.is_owned) {
9071 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9072 CHECK(!owner->result_ok);
9073 return DecodeError_clone(&*owner->contents.err);
9075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9076 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
9077 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9078 int64_t ret_ref = 0;
9079 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9080 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9081 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9082 ret_ref = (uintptr_t)ret_var.inner;
9083 if (ret_var.is_owned) {
9089 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9090 CHECK(owner->result_ok);
9091 return UpdateAddHTLC_clone(&*owner->contents.result);
9093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9094 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9095 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9096 int64_t ret_ref = 0;
9097 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9098 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9099 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9100 ret_ref = (uintptr_t)ret_var.inner;
9101 if (ret_var.is_owned) {
9107 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9108 CHECK(!owner->result_ok);
9109 return DecodeError_clone(&*owner->contents.err);
9111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9112 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
9113 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9114 int64_t ret_ref = 0;
9115 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9116 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9118 ret_ref = (uintptr_t)ret_var.inner;
9119 if (ret_var.is_owned) {
9125 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9126 CHECK(owner->result_ok);
9127 return Ping_clone(&*owner->contents.result);
9129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9130 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9131 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9132 int64_t ret_ref = 0;
9133 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9134 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9135 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9136 ret_ref = (uintptr_t)ret_var.inner;
9137 if (ret_var.is_owned) {
9143 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9144 CHECK(!owner->result_ok);
9145 return DecodeError_clone(&*owner->contents.err);
9147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9148 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
9149 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
9150 int64_t ret_ref = 0;
9151 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9152 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9154 ret_ref = (uintptr_t)ret_var.inner;
9155 if (ret_var.is_owned) {
9161 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9162 CHECK(owner->result_ok);
9163 return Pong_clone(&*owner->contents.result);
9165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9166 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9167 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9168 int64_t ret_ref = 0;
9169 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9170 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9171 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9172 ret_ref = (uintptr_t)ret_var.inner;
9173 if (ret_var.is_owned) {
9179 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9180 CHECK(!owner->result_ok);
9181 return DecodeError_clone(&*owner->contents.err);
9183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9184 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
9185 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
9186 int64_t ret_ref = 0;
9187 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9188 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9190 ret_ref = (uintptr_t)ret_var.inner;
9191 if (ret_var.is_owned) {
9197 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9198 CHECK(owner->result_ok);
9199 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
9201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9202 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9203 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9204 int64_t ret_ref = 0;
9205 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9206 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9207 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9208 ret_ref = (uintptr_t)ret_var.inner;
9209 if (ret_var.is_owned) {
9215 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9216 CHECK(!owner->result_ok);
9217 return DecodeError_clone(&*owner->contents.err);
9219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9220 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9221 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9222 int64_t ret_ref = 0;
9223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9226 ret_ref = (uintptr_t)ret_var.inner;
9227 if (ret_var.is_owned) {
9233 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9234 CHECK(owner->result_ok);
9235 return ChannelAnnouncement_clone(&*owner->contents.result);
9237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9238 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9239 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9240 int64_t ret_ref = 0;
9241 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9242 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9244 ret_ref = (uintptr_t)ret_var.inner;
9245 if (ret_var.is_owned) {
9251 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9252 CHECK(!owner->result_ok);
9253 return DecodeError_clone(&*owner->contents.err);
9255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9256 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
9257 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9258 int64_t ret_ref = 0;
9259 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9260 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9261 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9262 ret_ref = (uintptr_t)ret_var.inner;
9263 if (ret_var.is_owned) {
9269 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9270 CHECK(owner->result_ok);
9271 return UnsignedChannelUpdate_clone(&*owner->contents.result);
9273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9274 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9275 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9276 int64_t ret_ref = 0;
9277 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9278 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9279 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9280 ret_ref = (uintptr_t)ret_var.inner;
9281 if (ret_var.is_owned) {
9287 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9288 CHECK(!owner->result_ok);
9289 return DecodeError_clone(&*owner->contents.err);
9291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9292 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
9293 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9294 int64_t ret_ref = 0;
9295 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9296 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9297 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9298 ret_ref = (uintptr_t)ret_var.inner;
9299 if (ret_var.is_owned) {
9305 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9306 CHECK(owner->result_ok);
9307 return ChannelUpdate_clone(&*owner->contents.result);
9309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9310 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9311 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9312 int64_t ret_ref = 0;
9313 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9314 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9315 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9316 ret_ref = (uintptr_t)ret_var.inner;
9317 if (ret_var.is_owned) {
9323 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9324 CHECK(!owner->result_ok);
9325 return DecodeError_clone(&*owner->contents.err);
9327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9328 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
9329 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9330 int64_t ret_ref = 0;
9331 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9332 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9334 ret_ref = (uintptr_t)ret_var.inner;
9335 if (ret_var.is_owned) {
9341 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9342 CHECK(owner->result_ok);
9343 return ErrorMessage_clone(&*owner->contents.result);
9345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9346 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9347 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9348 int64_t ret_ref = 0;
9349 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9350 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9351 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9352 ret_ref = (uintptr_t)ret_var.inner;
9353 if (ret_var.is_owned) {
9359 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9360 CHECK(!owner->result_ok);
9361 return DecodeError_clone(&*owner->contents.err);
9363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9364 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9365 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9366 int64_t ret_ref = 0;
9367 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9368 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9370 ret_ref = (uintptr_t)ret_var.inner;
9371 if (ret_var.is_owned) {
9377 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9378 CHECK(owner->result_ok);
9379 return WarningMessage_clone(&*owner->contents.result);
9381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9382 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9383 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9384 int64_t ret_ref = 0;
9385 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9386 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9387 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9388 ret_ref = (uintptr_t)ret_var.inner;
9389 if (ret_var.is_owned) {
9395 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9396 CHECK(!owner->result_ok);
9397 return DecodeError_clone(&*owner->contents.err);
9399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9400 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9401 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9402 int64_t ret_ref = 0;
9403 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9404 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9405 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9406 ret_ref = (uintptr_t)ret_var.inner;
9407 if (ret_var.is_owned) {
9413 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9414 CHECK(owner->result_ok);
9415 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
9417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9418 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9419 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9420 int64_t ret_ref = 0;
9421 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9422 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9424 ret_ref = (uintptr_t)ret_var.inner;
9425 if (ret_var.is_owned) {
9431 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9432 CHECK(!owner->result_ok);
9433 return DecodeError_clone(&*owner->contents.err);
9435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9436 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9437 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9438 int64_t ret_ref = 0;
9439 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9440 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9441 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9442 ret_ref = (uintptr_t)ret_var.inner;
9443 if (ret_var.is_owned) {
9449 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9450 CHECK(owner->result_ok);
9451 return NodeAnnouncement_clone(&*owner->contents.result);
9453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9454 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9455 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9456 int64_t ret_ref = 0;
9457 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9458 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9459 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9460 ret_ref = (uintptr_t)ret_var.inner;
9461 if (ret_var.is_owned) {
9467 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9468 CHECK(!owner->result_ok);
9469 return DecodeError_clone(&*owner->contents.err);
9471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9472 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9473 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9474 int64_t ret_ref = 0;
9475 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9476 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9477 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9478 ret_ref = (uintptr_t)ret_var.inner;
9479 if (ret_var.is_owned) {
9485 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9486 CHECK(owner->result_ok);
9487 return QueryShortChannelIds_clone(&*owner->contents.result);
9489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9490 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9491 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9492 int64_t ret_ref = 0;
9493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9496 ret_ref = (uintptr_t)ret_var.inner;
9497 if (ret_var.is_owned) {
9503 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9504 CHECK(!owner->result_ok);
9505 return DecodeError_clone(&*owner->contents.err);
9507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9508 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9509 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9510 int64_t ret_ref = 0;
9511 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9512 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9513 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9514 ret_ref = (uintptr_t)ret_var.inner;
9515 if (ret_var.is_owned) {
9521 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9522 CHECK(owner->result_ok);
9523 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
9525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9526 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9527 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9528 int64_t ret_ref = 0;
9529 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9530 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9531 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9532 ret_ref = (uintptr_t)ret_var.inner;
9533 if (ret_var.is_owned) {
9539 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9540 CHECK(!owner->result_ok);
9541 return DecodeError_clone(&*owner->contents.err);
9543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9544 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9545 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9546 int64_t ret_ref = 0;
9547 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9548 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9550 ret_ref = (uintptr_t)ret_var.inner;
9551 if (ret_var.is_owned) {
9557 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9558 CHECK(owner->result_ok);
9559 return QueryChannelRange_clone(&*owner->contents.result);
9561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9562 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9563 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9564 int64_t ret_ref = 0;
9565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9568 ret_ref = (uintptr_t)ret_var.inner;
9569 if (ret_var.is_owned) {
9575 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9576 CHECK(!owner->result_ok);
9577 return DecodeError_clone(&*owner->contents.err);
9579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9580 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9581 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9582 int64_t ret_ref = 0;
9583 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9584 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9586 ret_ref = (uintptr_t)ret_var.inner;
9587 if (ret_var.is_owned) {
9593 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9594 CHECK(owner->result_ok);
9595 return ReplyChannelRange_clone(&*owner->contents.result);
9597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9598 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9599 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9600 int64_t ret_ref = 0;
9601 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9602 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9603 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9604 ret_ref = (uintptr_t)ret_var.inner;
9605 if (ret_var.is_owned) {
9611 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9612 CHECK(!owner->result_ok);
9613 return DecodeError_clone(&*owner->contents.err);
9615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9616 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9617 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9618 int64_t ret_ref = 0;
9619 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9620 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9621 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9622 ret_ref = (uintptr_t)ret_var.inner;
9623 if (ret_var.is_owned) {
9629 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9630 CHECK(owner->result_ok);
9631 return GossipTimestampFilter_clone(&*owner->contents.result);
9633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9634 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9635 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9636 int64_t ret_ref = 0;
9637 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9638 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9640 ret_ref = (uintptr_t)ret_var.inner;
9641 if (ret_var.is_owned) {
9647 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9648 CHECK(!owner->result_ok);
9649 return DecodeError_clone(&*owner->contents.err);
9651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9652 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9653 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9654 int64_t ret_ref = 0;
9655 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9656 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9658 ret_ref = (uintptr_t)ret_var.inner;
9659 if (ret_var.is_owned) {
9665 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9666 LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9667 for (size_t i = 0; i < ret.datalen; i++) {
9668 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9672 static jclass LDKSignOrCreationError_SignError_class = NULL;
9673 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
9674 static jclass LDKSignOrCreationError_CreationError_class = NULL;
9675 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
9676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
9677 LDKSignOrCreationError_SignError_class =
9678 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
9679 CHECK(LDKSignOrCreationError_SignError_class != NULL);
9680 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
9681 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
9682 LDKSignOrCreationError_CreationError_class =
9683 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
9684 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
9685 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
9686 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
9688 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9689 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
9691 case LDKSignOrCreationError_SignError: {
9692 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
9694 case LDKSignOrCreationError_CreationError: {
9695 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
9696 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
9701 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9702 CHECK(owner->result_ok);
9703 return Invoice_clone(&*owner->contents.result);
9705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9706 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9707 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9708 int64_t ret_ref = 0;
9709 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9710 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9712 ret_ref = (uintptr_t)ret_var.inner;
9713 if (ret_var.is_owned) {
9719 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9720 CHECK(!owner->result_ok);
9721 return SignOrCreationError_clone(&*owner->contents.err);
9723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9724 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9725 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9726 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9727 int64_t ret_ref = (uintptr_t)ret_copy;
9731 typedef struct LDKFilter_JCalls {
9732 atomic_size_t refcnt;
9735 jmethodID register_tx_meth;
9736 jmethodID register_output_meth;
9738 static void LDKFilter_JCalls_free(void* this_arg) {
9739 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9740 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9742 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9743 if (get_jenv_res == JNI_EDETACHED) {
9744 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9746 DO_ASSERT(get_jenv_res == JNI_OK);
9748 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9749 if (get_jenv_res == JNI_EDETACHED) {
9750 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9755 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
9756 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9758 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9759 if (get_jenv_res == JNI_EDETACHED) {
9760 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9762 DO_ASSERT(get_jenv_res == JNI_OK);
9764 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9765 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9766 LDKu8slice script_pubkey_var = script_pubkey;
9767 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
9768 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
9769 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9771 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
9772 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9773 (*env)->ExceptionDescribe(env);
9774 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
9776 if (get_jenv_res == JNI_EDETACHED) {
9777 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9780 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
9781 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9783 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9784 if (get_jenv_res == JNI_EDETACHED) {
9785 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9787 DO_ASSERT(get_jenv_res == JNI_OK);
9789 LDKWatchedOutput output_var = output;
9790 int64_t output_ref = 0;
9791 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9792 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9793 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
9794 output_ref = (uintptr_t)output_var.inner;
9795 if (output_var.is_owned) {
9798 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9800 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
9801 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9802 (*env)->ExceptionDescribe(env);
9803 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
9805 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9806 CHECK_ACCESS(ret_ptr);
9807 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
9809 if (get_jenv_res == JNI_EDETACHED) {
9810 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9814 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
9815 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
9816 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9818 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
9819 jclass c = (*env)->GetObjectClass(env, o);
9821 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
9822 atomic_init(&calls->refcnt, 1);
9823 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9824 calls->o = (*env)->NewWeakGlobalRef(env, o);
9825 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
9826 CHECK(calls->register_tx_meth != NULL);
9827 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
9828 CHECK(calls->register_output_meth != NULL);
9831 .this_arg = (void*) calls,
9832 .register_tx = register_tx_LDKFilter_jcall,
9833 .register_output = register_output_LDKFilter_jcall,
9834 .free = LDKFilter_JCalls_free,
9838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
9839 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9840 *res_ptr = LDKFilter_init(env, clz, o);
9841 return (uint64_t)res_ptr;
9843 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) {
9844 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9845 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9846 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9847 unsigned char txid_arr[32];
9848 CHECK((*env)->GetArrayLength(env, txid) == 32);
9849 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
9850 unsigned char (*txid_ref)[32] = &txid_arr;
9851 LDKu8slice script_pubkey_ref;
9852 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9853 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
9854 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
9855 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
9858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
9859 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9860 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9861 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9862 LDKWatchedOutput output_conv;
9863 output_conv.inner = (void*)(output & (~1));
9864 output_conv.is_owned = (output & 1) || (output == 0);
9865 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
9866 output_conv = WatchedOutput_clone(&output_conv);
9867 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9868 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
9869 int64_t ret_ref = (uintptr_t)ret_copy;
9873 static jclass LDKCOption_FilterZ_Some_class = NULL;
9874 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
9875 static jclass LDKCOption_FilterZ_None_class = NULL;
9876 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
9877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
9878 LDKCOption_FilterZ_Some_class =
9879 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
9880 CHECK(LDKCOption_FilterZ_Some_class != NULL);
9881 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
9882 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
9883 LDKCOption_FilterZ_None_class =
9884 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
9885 CHECK(LDKCOption_FilterZ_None_class != NULL);
9886 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
9887 CHECK(LDKCOption_FilterZ_None_meth != NULL);
9889 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9890 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
9892 case LDKCOption_FilterZ_Some: {
9893 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
9894 *some_ret = obj->some;
9895 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
9896 if ((*some_ret).free == LDKFilter_JCalls_free) {
9897 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9898 LDKFilter_JCalls_cloned(&(*some_ret));
9900 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (int64_t)some_ret);
9902 case LDKCOption_FilterZ_None: {
9903 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
9908 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9909 CHECK(owner->result_ok);
9910 return &*owner->contents.result;
9912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9913 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
9914 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
9915 int64_t ret_ref = 0;
9916 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9917 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9918 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9919 ret_ref = (uintptr_t)ret_var.inner & ~1;
9923 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9924 CHECK(!owner->result_ok);
9925 return *owner->contents.err;
9927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9928 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
9929 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
9932 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
9933 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
9934 for (size_t i = 0; i < ret.datalen; i++) {
9935 ret.data[i] = OutPoint_clone(&orig->data[i]);
9939 typedef struct LDKMessageSendEventsProvider_JCalls {
9940 atomic_size_t refcnt;
9943 jmethodID get_and_clear_pending_msg_events_meth;
9944 } LDKMessageSendEventsProvider_JCalls;
9945 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
9946 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9947 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9949 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9950 if (get_jenv_res == JNI_EDETACHED) {
9951 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9953 DO_ASSERT(get_jenv_res == JNI_OK);
9955 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9956 if (get_jenv_res == JNI_EDETACHED) {
9957 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9962 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
9963 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9965 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9966 if (get_jenv_res == JNI_EDETACHED) {
9967 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9969 DO_ASSERT(get_jenv_res == JNI_OK);
9971 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9973 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
9974 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9975 (*env)->ExceptionDescribe(env);
9976 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
9978 LDKCVec_MessageSendEventZ ret_constr;
9979 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9980 if (ret_constr.datalen > 0)
9981 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9983 ret_constr.data = NULL;
9984 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9985 for (size_t s = 0; s < ret_constr.datalen; s++) {
9986 int64_t ret_conv_18 = ret_vals[s];
9987 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
9988 CHECK_ACCESS(ret_conv_18_ptr);
9989 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
9990 FREE((void*)ret_conv_18);
9991 ret_constr.data[s] = ret_conv_18_conv;
9993 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9994 if (get_jenv_res == JNI_EDETACHED) {
9995 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9999 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
10000 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
10001 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10003 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10004 jclass c = (*env)->GetObjectClass(env, o);
10006 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
10007 atomic_init(&calls->refcnt, 1);
10008 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10009 calls->o = (*env)->NewWeakGlobalRef(env, o);
10010 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
10011 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
10013 LDKMessageSendEventsProvider ret = {
10014 .this_arg = (void*) calls,
10015 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
10016 .free = LDKMessageSendEventsProvider_JCalls_free,
10020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10021 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
10022 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
10023 return (uint64_t)res_ptr;
10025 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
10026 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10027 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10028 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
10029 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
10030 int64_tArray ret_arr = NULL;
10031 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
10032 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
10033 for (size_t s = 0; s < ret_var.datalen; s++) {
10034 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
10035 *ret_conv_18_copy = ret_var.data[s];
10036 int64_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
10037 ret_arr_ptr[s] = ret_conv_18_ref;
10039 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
10040 FREE(ret_var.data);
10044 typedef struct LDKEventHandler_JCalls {
10045 atomic_size_t refcnt;
10048 jmethodID handle_event_meth;
10049 } LDKEventHandler_JCalls;
10050 static void LDKEventHandler_JCalls_free(void* this_arg) {
10051 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10052 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10054 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10055 if (get_jenv_res == JNI_EDETACHED) {
10056 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10058 DO_ASSERT(get_jenv_res == JNI_OK);
10060 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10061 if (get_jenv_res == JNI_EDETACHED) {
10062 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10067 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
10068 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
10070 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10071 if (get_jenv_res == JNI_EDETACHED) {
10072 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10074 DO_ASSERT(get_jenv_res == JNI_OK);
10076 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
10077 *ret_event = Event_clone(event);
10078 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10079 CHECK(obj != NULL);
10080 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (int64_t)ret_event);
10081 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10082 (*env)->ExceptionDescribe(env);
10083 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
10085 if (get_jenv_res == JNI_EDETACHED) {
10086 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10089 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
10090 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
10091 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10093 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
10094 jclass c = (*env)->GetObjectClass(env, o);
10096 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
10097 atomic_init(&calls->refcnt, 1);
10098 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10099 calls->o = (*env)->NewWeakGlobalRef(env, o);
10100 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
10101 CHECK(calls->handle_event_meth != NULL);
10103 LDKEventHandler ret = {
10104 .this_arg = (void*) calls,
10105 .handle_event = handle_event_LDKEventHandler_jcall,
10106 .free = LDKEventHandler_JCalls_free,
10110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
10111 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10112 *res_ptr = LDKEventHandler_init(env, clz, o);
10113 return (uint64_t)res_ptr;
10115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
10116 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10117 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10118 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
10119 LDKEvent* event_conv = (LDKEvent*)event;
10120 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
10123 typedef struct LDKEventsProvider_JCalls {
10124 atomic_size_t refcnt;
10127 jmethodID process_pending_events_meth;
10128 } LDKEventsProvider_JCalls;
10129 static void LDKEventsProvider_JCalls_free(void* this_arg) {
10130 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10131 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10133 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10134 if (get_jenv_res == JNI_EDETACHED) {
10135 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10137 DO_ASSERT(get_jenv_res == JNI_OK);
10139 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10140 if (get_jenv_res == JNI_EDETACHED) {
10141 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10146 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
10147 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
10149 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10150 if (get_jenv_res == JNI_EDETACHED) {
10151 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10153 DO_ASSERT(get_jenv_res == JNI_OK);
10155 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
10156 *handler_ret = handler;
10157 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10158 CHECK(obj != NULL);
10159 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (int64_t)handler_ret);
10160 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10161 (*env)->ExceptionDescribe(env);
10162 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
10164 if (get_jenv_res == JNI_EDETACHED) {
10165 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10168 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
10169 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
10170 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10172 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
10173 jclass c = (*env)->GetObjectClass(env, o);
10175 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
10176 atomic_init(&calls->refcnt, 1);
10177 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10178 calls->o = (*env)->NewWeakGlobalRef(env, o);
10179 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
10180 CHECK(calls->process_pending_events_meth != NULL);
10182 LDKEventsProvider ret = {
10183 .this_arg = (void*) calls,
10184 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
10185 .free = LDKEventsProvider_JCalls_free,
10189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
10190 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
10191 *res_ptr = LDKEventsProvider_init(env, clz, o);
10192 return (uint64_t)res_ptr;
10194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
10195 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10196 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10197 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
10198 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
10199 CHECK_ACCESS(handler_ptr);
10200 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
10201 if (handler_conv.free == LDKEventHandler_JCalls_free) {
10202 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10203 LDKEventHandler_JCalls_cloned(&handler_conv);
10205 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
10208 typedef struct LDKListen_JCalls {
10209 atomic_size_t refcnt;
10212 jmethodID block_connected_meth;
10213 jmethodID block_disconnected_meth;
10214 } LDKListen_JCalls;
10215 static void LDKListen_JCalls_free(void* this_arg) {
10216 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10217 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10219 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10220 if (get_jenv_res == JNI_EDETACHED) {
10221 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10223 DO_ASSERT(get_jenv_res == JNI_OK);
10225 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10226 if (get_jenv_res == JNI_EDETACHED) {
10227 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10232 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
10233 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10235 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10236 if (get_jenv_res == JNI_EDETACHED) {
10237 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10239 DO_ASSERT(get_jenv_res == JNI_OK);
10241 LDKu8slice block_var = block;
10242 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
10243 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
10244 int32_t height_conv = height;
10245 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10246 CHECK(obj != NULL);
10247 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
10248 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10249 (*env)->ExceptionDescribe(env);
10250 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
10252 if (get_jenv_res == JNI_EDETACHED) {
10253 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10256 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10257 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
10259 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10260 if (get_jenv_res == JNI_EDETACHED) {
10261 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10263 DO_ASSERT(get_jenv_res == JNI_OK);
10265 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10266 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10267 int32_t height_conv = height;
10268 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10269 CHECK(obj != NULL);
10270 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
10271 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10272 (*env)->ExceptionDescribe(env);
10273 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
10275 if (get_jenv_res == JNI_EDETACHED) {
10276 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10279 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
10280 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
10281 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10283 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
10284 jclass c = (*env)->GetObjectClass(env, o);
10286 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
10287 atomic_init(&calls->refcnt, 1);
10288 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10289 calls->o = (*env)->NewWeakGlobalRef(env, o);
10290 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
10291 CHECK(calls->block_connected_meth != NULL);
10292 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
10293 CHECK(calls->block_disconnected_meth != NULL);
10296 .this_arg = (void*) calls,
10297 .block_connected = block_connected_LDKListen_jcall,
10298 .block_disconnected = block_disconnected_LDKListen_jcall,
10299 .free = LDKListen_JCalls_free,
10303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
10304 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
10305 *res_ptr = LDKListen_init(env, clz, o);
10306 return (uint64_t)res_ptr;
10308 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) {
10309 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10310 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10311 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10312 LDKu8slice block_ref;
10313 block_ref.datalen = (*env)->GetArrayLength(env, block);
10314 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
10315 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
10316 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
10319 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) {
10320 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10321 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10322 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
10323 unsigned char header_arr[80];
10324 CHECK((*env)->GetArrayLength(env, header) == 80);
10325 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10326 unsigned char (*header_ref)[80] = &header_arr;
10327 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
10330 typedef struct LDKConfirm_JCalls {
10331 atomic_size_t refcnt;
10334 jmethodID transactions_confirmed_meth;
10335 jmethodID transaction_unconfirmed_meth;
10336 jmethodID best_block_updated_meth;
10337 jmethodID get_relevant_txids_meth;
10338 } LDKConfirm_JCalls;
10339 static void LDKConfirm_JCalls_free(void* this_arg) {
10340 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10341 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10343 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10344 if (get_jenv_res == JNI_EDETACHED) {
10345 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10347 DO_ASSERT(get_jenv_res == JNI_OK);
10349 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10350 if (get_jenv_res == JNI_EDETACHED) {
10351 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10356 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10357 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10359 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10360 if (get_jenv_res == JNI_EDETACHED) {
10361 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10363 DO_ASSERT(get_jenv_res == JNI_OK);
10365 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10366 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10367 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10368 int64_tArray txdata_arr = NULL;
10369 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10370 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10371 for (size_t c = 0; c < txdata_var.datalen; c++) {
10372 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10373 *txdata_conv_28_conv = txdata_var.data[c];
10374 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
10376 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10377 FREE(txdata_var.data);
10378 int32_t height_conv = height;
10379 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10380 CHECK(obj != NULL);
10381 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
10382 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10383 (*env)->ExceptionDescribe(env);
10384 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
10386 if (get_jenv_res == JNI_EDETACHED) {
10387 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10390 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
10391 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10393 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10394 if (get_jenv_res == JNI_EDETACHED) {
10395 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10397 DO_ASSERT(get_jenv_res == JNI_OK);
10399 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
10400 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
10401 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10402 CHECK(obj != NULL);
10403 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
10404 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10405 (*env)->ExceptionDescribe(env);
10406 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
10408 if (get_jenv_res == JNI_EDETACHED) {
10409 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10412 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10413 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10415 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10416 if (get_jenv_res == JNI_EDETACHED) {
10417 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10419 DO_ASSERT(get_jenv_res == JNI_OK);
10421 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10422 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10423 int32_t height_conv = height;
10424 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10425 CHECK(obj != NULL);
10426 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
10427 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10428 (*env)->ExceptionDescribe(env);
10429 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
10431 if (get_jenv_res == JNI_EDETACHED) {
10432 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10435 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
10436 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10438 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10439 if (get_jenv_res == JNI_EDETACHED) {
10440 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10442 DO_ASSERT(get_jenv_res == JNI_OK);
10444 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10445 CHECK(obj != NULL);
10446 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
10447 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10448 (*env)->ExceptionDescribe(env);
10449 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
10451 LDKCVec_TxidZ ret_constr;
10452 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10453 if (ret_constr.datalen > 0)
10454 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10456 ret_constr.data = NULL;
10457 for (size_t i = 0; i < ret_constr.datalen; i++) {
10458 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
10459 LDKThirtyTwoBytes ret_conv_8_ref;
10460 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
10461 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
10462 ret_constr.data[i] = ret_conv_8_ref;
10464 if (get_jenv_res == JNI_EDETACHED) {
10465 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10469 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
10470 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
10471 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10473 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
10474 jclass c = (*env)->GetObjectClass(env, o);
10476 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
10477 atomic_init(&calls->refcnt, 1);
10478 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10479 calls->o = (*env)->NewWeakGlobalRef(env, o);
10480 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
10481 CHECK(calls->transactions_confirmed_meth != NULL);
10482 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
10483 CHECK(calls->transaction_unconfirmed_meth != NULL);
10484 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
10485 CHECK(calls->best_block_updated_meth != NULL);
10486 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
10487 CHECK(calls->get_relevant_txids_meth != NULL);
10490 .this_arg = (void*) calls,
10491 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
10492 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
10493 .best_block_updated = best_block_updated_LDKConfirm_jcall,
10494 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
10495 .free = LDKConfirm_JCalls_free,
10499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
10500 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
10501 *res_ptr = LDKConfirm_init(env, clz, o);
10502 return (uint64_t)res_ptr;
10504 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) {
10505 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10506 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10507 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10508 unsigned char header_arr[80];
10509 CHECK((*env)->GetArrayLength(env, header) == 80);
10510 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10511 unsigned char (*header_ref)[80] = &header_arr;
10512 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10513 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10514 if (txdata_constr.datalen > 0)
10515 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10517 txdata_constr.data = NULL;
10518 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10519 for (size_t c = 0; c < txdata_constr.datalen; c++) {
10520 int64_t txdata_conv_28 = txdata_vals[c];
10521 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
10522 CHECK_ACCESS(txdata_conv_28_ptr);
10523 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10524 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
10525 txdata_constr.data[c] = txdata_conv_28_conv;
10527 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10528 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
10532 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10533 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10534 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10535 unsigned char txid_arr[32];
10536 CHECK((*env)->GetArrayLength(env, txid) == 32);
10537 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10538 unsigned char (*txid_ref)[32] = &txid_arr;
10539 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
10542 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) {
10543 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10544 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10545 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10546 unsigned char header_arr[80];
10547 CHECK((*env)->GetArrayLength(env, header) == 80);
10548 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10549 unsigned char (*header_ref)[80] = &header_arr;
10550 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
10553 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
10554 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10555 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10556 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10557 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
10558 jobjectArray ret_arr = NULL;
10559 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10561 for (size_t i = 0; i < ret_var.datalen; i++) {
10562 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
10563 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
10564 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
10567 FREE(ret_var.data);
10571 typedef struct LDKPersist_JCalls {
10572 atomic_size_t refcnt;
10575 jmethodID persist_new_channel_meth;
10576 jmethodID update_persisted_channel_meth;
10577 } LDKPersist_JCalls;
10578 static void LDKPersist_JCalls_free(void* this_arg) {
10579 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10580 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10582 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10583 if (get_jenv_res == JNI_EDETACHED) {
10584 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10586 DO_ASSERT(get_jenv_res == JNI_OK);
10588 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10589 if (get_jenv_res == JNI_EDETACHED) {
10590 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10595 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10596 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10598 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10599 if (get_jenv_res == JNI_EDETACHED) {
10600 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10602 DO_ASSERT(get_jenv_res == JNI_OK);
10604 LDKOutPoint channel_id_var = channel_id;
10605 int64_t channel_id_ref = 0;
10606 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10607 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10608 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10609 channel_id_ref = (uintptr_t)channel_id_var.inner;
10610 if (channel_id_var.is_owned) {
10611 channel_id_ref |= 1;
10613 LDKChannelMonitor data_var = *data;
10614 int64_t data_ref = 0;
10615 data_var = ChannelMonitor_clone(&data_var);
10616 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10617 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10618 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10619 data_ref = (uintptr_t)data_var.inner;
10620 if (data_var.is_owned) {
10623 LDKMonitorUpdateId update_id_var = update_id;
10624 int64_t update_id_ref = 0;
10625 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10626 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10627 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10628 update_id_ref = (uintptr_t)update_id_var.inner;
10629 if (update_id_var.is_owned) {
10630 update_id_ref |= 1;
10632 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10633 CHECK(obj != NULL);
10634 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
10635 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10636 (*env)->ExceptionDescribe(env);
10637 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
10639 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10640 CHECK_ACCESS(ret_ptr);
10641 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10643 if (get_jenv_res == JNI_EDETACHED) {
10644 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10648 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10649 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10651 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10652 if (get_jenv_res == JNI_EDETACHED) {
10653 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10655 DO_ASSERT(get_jenv_res == JNI_OK);
10657 LDKOutPoint channel_id_var = channel_id;
10658 int64_t channel_id_ref = 0;
10659 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10660 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10661 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10662 channel_id_ref = (uintptr_t)channel_id_var.inner;
10663 if (channel_id_var.is_owned) {
10664 channel_id_ref |= 1;
10666 LDKChannelMonitorUpdate update_var = *update;
10667 int64_t update_ref = 0;
10668 if ((uintptr_t)update_var.inner > 4096) {
10669 update_var = ChannelMonitorUpdate_clone(&update_var);
10670 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10671 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10672 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
10673 update_ref = (uintptr_t)update_var.inner;
10674 if (update_var.is_owned) {
10678 LDKChannelMonitor data_var = *data;
10679 int64_t data_ref = 0;
10680 data_var = ChannelMonitor_clone(&data_var);
10681 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10682 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10683 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10684 data_ref = (uintptr_t)data_var.inner;
10685 if (data_var.is_owned) {
10688 LDKMonitorUpdateId update_id_var = update_id;
10689 int64_t update_id_ref = 0;
10690 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10691 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10692 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10693 update_id_ref = (uintptr_t)update_id_var.inner;
10694 if (update_id_var.is_owned) {
10695 update_id_ref |= 1;
10697 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10698 CHECK(obj != NULL);
10699 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
10700 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10701 (*env)->ExceptionDescribe(env);
10702 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
10704 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10705 CHECK_ACCESS(ret_ptr);
10706 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10708 if (get_jenv_res == JNI_EDETACHED) {
10709 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10713 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
10714 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
10715 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10717 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
10718 jclass c = (*env)->GetObjectClass(env, o);
10720 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
10721 atomic_init(&calls->refcnt, 1);
10722 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10723 calls->o = (*env)->NewWeakGlobalRef(env, o);
10724 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
10725 CHECK(calls->persist_new_channel_meth != NULL);
10726 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
10727 CHECK(calls->update_persisted_channel_meth != NULL);
10730 .this_arg = (void*) calls,
10731 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
10732 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
10733 .free = LDKPersist_JCalls_free,
10737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
10738 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
10739 *res_ptr = LDKPersist_init(env, clz, o);
10740 return (uint64_t)res_ptr;
10742 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) {
10743 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10744 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10745 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10746 LDKOutPoint channel_id_conv;
10747 channel_id_conv.inner = (void*)(channel_id & (~1));
10748 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
10749 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10750 channel_id_conv = OutPoint_clone(&channel_id_conv);
10751 LDKChannelMonitor data_conv;
10752 data_conv.inner = (void*)(data & (~1));
10753 data_conv.is_owned = false;
10754 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10755 LDKMonitorUpdateId update_id_conv;
10756 update_id_conv.inner = (void*)(update_id & (~1));
10757 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
10758 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10759 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10760 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10761 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
10762 return (int64_t)ret_conv;
10765 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) {
10766 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10767 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10768 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10769 LDKOutPoint channel_id_conv;
10770 channel_id_conv.inner = (void*)(channel_id & (~1));
10771 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
10772 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10773 channel_id_conv = OutPoint_clone(&channel_id_conv);
10774 LDKChannelMonitorUpdate update_conv;
10775 update_conv.inner = (void*)(update & (~1));
10776 update_conv.is_owned = false;
10777 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
10778 LDKChannelMonitor data_conv;
10779 data_conv.inner = (void*)(data & (~1));
10780 data_conv.is_owned = false;
10781 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10782 LDKMonitorUpdateId update_id_conv;
10783 update_id_conv.inner = (void*)(update_id & (~1));
10784 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
10785 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10786 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10787 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10788 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
10789 return (int64_t)ret_conv;
10792 typedef struct LDKChannelMessageHandler_JCalls {
10793 atomic_size_t refcnt;
10796 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10797 jmethodID handle_open_channel_meth;
10798 jmethodID handle_accept_channel_meth;
10799 jmethodID handle_funding_created_meth;
10800 jmethodID handle_funding_signed_meth;
10801 jmethodID handle_funding_locked_meth;
10802 jmethodID handle_shutdown_meth;
10803 jmethodID handle_closing_signed_meth;
10804 jmethodID handle_update_add_htlc_meth;
10805 jmethodID handle_update_fulfill_htlc_meth;
10806 jmethodID handle_update_fail_htlc_meth;
10807 jmethodID handle_update_fail_malformed_htlc_meth;
10808 jmethodID handle_commitment_signed_meth;
10809 jmethodID handle_revoke_and_ack_meth;
10810 jmethodID handle_update_fee_meth;
10811 jmethodID handle_announcement_signatures_meth;
10812 jmethodID peer_disconnected_meth;
10813 jmethodID peer_connected_meth;
10814 jmethodID handle_channel_reestablish_meth;
10815 jmethodID handle_channel_update_meth;
10816 jmethodID handle_error_meth;
10817 } LDKChannelMessageHandler_JCalls;
10818 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
10819 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10820 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10822 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10823 if (get_jenv_res == JNI_EDETACHED) {
10824 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10826 DO_ASSERT(get_jenv_res == JNI_OK);
10828 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10829 if (get_jenv_res == JNI_EDETACHED) {
10830 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10835 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
10836 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10838 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10839 if (get_jenv_res == JNI_EDETACHED) {
10840 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10842 DO_ASSERT(get_jenv_res == JNI_OK);
10844 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10845 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10846 LDKInitFeatures their_features_var = their_features;
10847 int64_t their_features_ref = 0;
10848 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10849 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10850 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10851 their_features_ref = (uintptr_t)their_features_var.inner;
10852 if (their_features_var.is_owned) {
10853 their_features_ref |= 1;
10855 LDKOpenChannel msg_var = *msg;
10856 int64_t msg_ref = 0;
10857 msg_var = OpenChannel_clone(&msg_var);
10858 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10859 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10860 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10861 msg_ref = (uintptr_t)msg_var.inner;
10862 if (msg_var.is_owned) {
10865 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10866 CHECK(obj != NULL);
10867 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10868 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10869 (*env)->ExceptionDescribe(env);
10870 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
10872 if (get_jenv_res == JNI_EDETACHED) {
10873 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10876 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
10877 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10879 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10880 if (get_jenv_res == JNI_EDETACHED) {
10881 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10883 DO_ASSERT(get_jenv_res == JNI_OK);
10885 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10886 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10887 LDKInitFeatures their_features_var = their_features;
10888 int64_t their_features_ref = 0;
10889 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10890 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10891 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10892 their_features_ref = (uintptr_t)their_features_var.inner;
10893 if (their_features_var.is_owned) {
10894 their_features_ref |= 1;
10896 LDKAcceptChannel msg_var = *msg;
10897 int64_t msg_ref = 0;
10898 msg_var = AcceptChannel_clone(&msg_var);
10899 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10900 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10901 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10902 msg_ref = (uintptr_t)msg_var.inner;
10903 if (msg_var.is_owned) {
10906 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10907 CHECK(obj != NULL);
10908 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10909 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10910 (*env)->ExceptionDescribe(env);
10911 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
10913 if (get_jenv_res == JNI_EDETACHED) {
10914 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10917 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
10918 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10920 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10921 if (get_jenv_res == JNI_EDETACHED) {
10922 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10924 DO_ASSERT(get_jenv_res == JNI_OK);
10926 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10927 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10928 LDKFundingCreated msg_var = *msg;
10929 int64_t msg_ref = 0;
10930 msg_var = FundingCreated_clone(&msg_var);
10931 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10932 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10933 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10934 msg_ref = (uintptr_t)msg_var.inner;
10935 if (msg_var.is_owned) {
10938 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10939 CHECK(obj != NULL);
10940 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
10941 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10942 (*env)->ExceptionDescribe(env);
10943 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
10945 if (get_jenv_res == JNI_EDETACHED) {
10946 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10949 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
10950 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10952 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10953 if (get_jenv_res == JNI_EDETACHED) {
10954 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10956 DO_ASSERT(get_jenv_res == JNI_OK);
10958 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10959 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10960 LDKFundingSigned msg_var = *msg;
10961 int64_t msg_ref = 0;
10962 msg_var = FundingSigned_clone(&msg_var);
10963 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10964 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10965 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10966 msg_ref = (uintptr_t)msg_var.inner;
10967 if (msg_var.is_owned) {
10970 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10971 CHECK(obj != NULL);
10972 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
10973 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10974 (*env)->ExceptionDescribe(env);
10975 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
10977 if (get_jenv_res == JNI_EDETACHED) {
10978 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10981 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
10982 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10984 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10985 if (get_jenv_res == JNI_EDETACHED) {
10986 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10988 DO_ASSERT(get_jenv_res == JNI_OK);
10990 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10991 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10992 LDKFundingLocked msg_var = *msg;
10993 int64_t msg_ref = 0;
10994 msg_var = FundingLocked_clone(&msg_var);
10995 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10996 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10997 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10998 msg_ref = (uintptr_t)msg_var.inner;
10999 if (msg_var.is_owned) {
11002 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11003 CHECK(obj != NULL);
11004 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
11005 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11006 (*env)->ExceptionDescribe(env);
11007 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
11009 if (get_jenv_res == JNI_EDETACHED) {
11010 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11013 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
11014 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11016 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11017 if (get_jenv_res == JNI_EDETACHED) {
11018 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11020 DO_ASSERT(get_jenv_res == JNI_OK);
11022 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11023 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11024 LDKInitFeatures their_features_var = *their_features;
11025 int64_t their_features_ref = 0;
11026 their_features_var = InitFeatures_clone(&their_features_var);
11027 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11028 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11029 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
11030 their_features_ref = (uintptr_t)their_features_var.inner;
11031 if (their_features_var.is_owned) {
11032 their_features_ref |= 1;
11034 LDKShutdown msg_var = *msg;
11035 int64_t msg_ref = 0;
11036 msg_var = Shutdown_clone(&msg_var);
11037 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11038 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11039 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11040 msg_ref = (uintptr_t)msg_var.inner;
11041 if (msg_var.is_owned) {
11044 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11045 CHECK(obj != NULL);
11046 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
11047 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11048 (*env)->ExceptionDescribe(env);
11049 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
11051 if (get_jenv_res == JNI_EDETACHED) {
11052 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11055 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
11056 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11058 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11059 if (get_jenv_res == JNI_EDETACHED) {
11060 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11062 DO_ASSERT(get_jenv_res == JNI_OK);
11064 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11065 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11066 LDKClosingSigned msg_var = *msg;
11067 int64_t msg_ref = 0;
11068 msg_var = ClosingSigned_clone(&msg_var);
11069 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11070 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11071 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11072 msg_ref = (uintptr_t)msg_var.inner;
11073 if (msg_var.is_owned) {
11076 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11077 CHECK(obj != NULL);
11078 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
11079 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11080 (*env)->ExceptionDescribe(env);
11081 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
11083 if (get_jenv_res == JNI_EDETACHED) {
11084 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11087 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
11088 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_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 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11097 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11098 LDKUpdateAddHTLC msg_var = *msg;
11099 int64_t msg_ref = 0;
11100 msg_var = UpdateAddHTLC_clone(&msg_var);
11101 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11102 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11103 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11104 msg_ref = (uintptr_t)msg_var.inner;
11105 if (msg_var.is_owned) {
11108 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11109 CHECK(obj != NULL);
11110 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
11111 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11112 (*env)->ExceptionDescribe(env);
11113 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
11115 if (get_jenv_res == JNI_EDETACHED) {
11116 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11119 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
11120 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11122 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11123 if (get_jenv_res == JNI_EDETACHED) {
11124 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11126 DO_ASSERT(get_jenv_res == JNI_OK);
11128 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11129 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11130 LDKUpdateFulfillHTLC msg_var = *msg;
11131 int64_t msg_ref = 0;
11132 msg_var = UpdateFulfillHTLC_clone(&msg_var);
11133 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11134 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11135 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11136 msg_ref = (uintptr_t)msg_var.inner;
11137 if (msg_var.is_owned) {
11140 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11141 CHECK(obj != NULL);
11142 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
11143 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11144 (*env)->ExceptionDescribe(env);
11145 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
11147 if (get_jenv_res == JNI_EDETACHED) {
11148 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11151 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
11152 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11154 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11155 if (get_jenv_res == JNI_EDETACHED) {
11156 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11158 DO_ASSERT(get_jenv_res == JNI_OK);
11160 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11161 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11162 LDKUpdateFailHTLC msg_var = *msg;
11163 int64_t msg_ref = 0;
11164 msg_var = UpdateFailHTLC_clone(&msg_var);
11165 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11166 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11167 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11168 msg_ref = (uintptr_t)msg_var.inner;
11169 if (msg_var.is_owned) {
11172 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11173 CHECK(obj != NULL);
11174 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
11175 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11176 (*env)->ExceptionDescribe(env);
11177 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
11179 if (get_jenv_res == JNI_EDETACHED) {
11180 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11183 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
11184 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11186 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11187 if (get_jenv_res == JNI_EDETACHED) {
11188 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11190 DO_ASSERT(get_jenv_res == JNI_OK);
11192 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11193 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11194 LDKUpdateFailMalformedHTLC msg_var = *msg;
11195 int64_t msg_ref = 0;
11196 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
11197 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11198 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11199 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11200 msg_ref = (uintptr_t)msg_var.inner;
11201 if (msg_var.is_owned) {
11204 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11205 CHECK(obj != NULL);
11206 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
11207 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11208 (*env)->ExceptionDescribe(env);
11209 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
11211 if (get_jenv_res == JNI_EDETACHED) {
11212 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11215 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
11216 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11218 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11219 if (get_jenv_res == JNI_EDETACHED) {
11220 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11222 DO_ASSERT(get_jenv_res == JNI_OK);
11224 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11225 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11226 LDKCommitmentSigned msg_var = *msg;
11227 int64_t msg_ref = 0;
11228 msg_var = CommitmentSigned_clone(&msg_var);
11229 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11230 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11231 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11232 msg_ref = (uintptr_t)msg_var.inner;
11233 if (msg_var.is_owned) {
11236 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11237 CHECK(obj != NULL);
11238 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
11239 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11240 (*env)->ExceptionDescribe(env);
11241 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
11243 if (get_jenv_res == JNI_EDETACHED) {
11244 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11247 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
11248 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11250 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11251 if (get_jenv_res == JNI_EDETACHED) {
11252 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11254 DO_ASSERT(get_jenv_res == JNI_OK);
11256 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11257 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11258 LDKRevokeAndACK msg_var = *msg;
11259 int64_t msg_ref = 0;
11260 msg_var = RevokeAndACK_clone(&msg_var);
11261 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11262 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11263 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11264 msg_ref = (uintptr_t)msg_var.inner;
11265 if (msg_var.is_owned) {
11268 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11269 CHECK(obj != NULL);
11270 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
11271 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11272 (*env)->ExceptionDescribe(env);
11273 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
11275 if (get_jenv_res == JNI_EDETACHED) {
11276 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11279 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
11280 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11282 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11283 if (get_jenv_res == JNI_EDETACHED) {
11284 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11286 DO_ASSERT(get_jenv_res == JNI_OK);
11288 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11289 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11290 LDKUpdateFee msg_var = *msg;
11291 int64_t msg_ref = 0;
11292 msg_var = UpdateFee_clone(&msg_var);
11293 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11294 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11295 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11296 msg_ref = (uintptr_t)msg_var.inner;
11297 if (msg_var.is_owned) {
11300 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11301 CHECK(obj != NULL);
11302 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
11303 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11304 (*env)->ExceptionDescribe(env);
11305 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
11307 if (get_jenv_res == JNI_EDETACHED) {
11308 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11311 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
11312 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11314 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11315 if (get_jenv_res == JNI_EDETACHED) {
11316 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11318 DO_ASSERT(get_jenv_res == JNI_OK);
11320 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11321 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11322 LDKAnnouncementSignatures msg_var = *msg;
11323 int64_t msg_ref = 0;
11324 msg_var = AnnouncementSignatures_clone(&msg_var);
11325 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11326 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11327 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11328 msg_ref = (uintptr_t)msg_var.inner;
11329 if (msg_var.is_owned) {
11332 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11333 CHECK(obj != NULL);
11334 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
11335 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11336 (*env)->ExceptionDescribe(env);
11337 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
11339 if (get_jenv_res == JNI_EDETACHED) {
11340 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11343 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
11344 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11346 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11347 if (get_jenv_res == JNI_EDETACHED) {
11348 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11350 DO_ASSERT(get_jenv_res == JNI_OK);
11352 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11353 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11354 jboolean no_connection_possible_conv = no_connection_possible;
11355 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11356 CHECK(obj != NULL);
11357 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible_conv);
11358 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11359 (*env)->ExceptionDescribe(env);
11360 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
11362 if (get_jenv_res == JNI_EDETACHED) {
11363 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11366 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
11367 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11369 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11370 if (get_jenv_res == JNI_EDETACHED) {
11371 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11373 DO_ASSERT(get_jenv_res == JNI_OK);
11375 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11376 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11377 LDKInit msg_var = *msg;
11378 int64_t msg_ref = 0;
11379 msg_var = Init_clone(&msg_var);
11380 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11381 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11382 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11383 msg_ref = (uintptr_t)msg_var.inner;
11384 if (msg_var.is_owned) {
11387 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11388 CHECK(obj != NULL);
11389 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
11390 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11391 (*env)->ExceptionDescribe(env);
11392 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
11394 if (get_jenv_res == JNI_EDETACHED) {
11395 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11398 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
11399 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11401 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11402 if (get_jenv_res == JNI_EDETACHED) {
11403 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11405 DO_ASSERT(get_jenv_res == JNI_OK);
11407 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11408 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11409 LDKChannelReestablish msg_var = *msg;
11410 int64_t msg_ref = 0;
11411 msg_var = ChannelReestablish_clone(&msg_var);
11412 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11413 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11414 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11415 msg_ref = (uintptr_t)msg_var.inner;
11416 if (msg_var.is_owned) {
11419 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11420 CHECK(obj != NULL);
11421 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
11422 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11423 (*env)->ExceptionDescribe(env);
11424 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
11426 if (get_jenv_res == JNI_EDETACHED) {
11427 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11430 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
11431 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11433 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11434 if (get_jenv_res == JNI_EDETACHED) {
11435 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11437 DO_ASSERT(get_jenv_res == JNI_OK);
11439 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11440 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11441 LDKChannelUpdate msg_var = *msg;
11442 int64_t msg_ref = 0;
11443 msg_var = ChannelUpdate_clone(&msg_var);
11444 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11445 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11446 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11447 msg_ref = (uintptr_t)msg_var.inner;
11448 if (msg_var.is_owned) {
11451 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11452 CHECK(obj != NULL);
11453 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
11454 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11455 (*env)->ExceptionDescribe(env);
11456 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
11458 if (get_jenv_res == JNI_EDETACHED) {
11459 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11462 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
11463 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11465 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11466 if (get_jenv_res == JNI_EDETACHED) {
11467 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11469 DO_ASSERT(get_jenv_res == JNI_OK);
11471 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11472 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11473 LDKErrorMessage msg_var = *msg;
11474 int64_t msg_ref = 0;
11475 msg_var = ErrorMessage_clone(&msg_var);
11476 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11477 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11478 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11479 msg_ref = (uintptr_t)msg_var.inner;
11480 if (msg_var.is_owned) {
11483 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11484 CHECK(obj != NULL);
11485 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
11486 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11487 (*env)->ExceptionDescribe(env);
11488 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
11490 if (get_jenv_res == JNI_EDETACHED) {
11491 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11494 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
11495 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
11496 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11497 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11499 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11500 jclass c = (*env)->GetObjectClass(env, o);
11502 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
11503 atomic_init(&calls->refcnt, 1);
11504 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11505 calls->o = (*env)->NewWeakGlobalRef(env, o);
11506 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
11507 CHECK(calls->handle_open_channel_meth != NULL);
11508 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
11509 CHECK(calls->handle_accept_channel_meth != NULL);
11510 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
11511 CHECK(calls->handle_funding_created_meth != NULL);
11512 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
11513 CHECK(calls->handle_funding_signed_meth != NULL);
11514 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
11515 CHECK(calls->handle_funding_locked_meth != NULL);
11516 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
11517 CHECK(calls->handle_shutdown_meth != NULL);
11518 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
11519 CHECK(calls->handle_closing_signed_meth != NULL);
11520 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
11521 CHECK(calls->handle_update_add_htlc_meth != NULL);
11522 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
11523 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
11524 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
11525 CHECK(calls->handle_update_fail_htlc_meth != NULL);
11526 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
11527 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
11528 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
11529 CHECK(calls->handle_commitment_signed_meth != NULL);
11530 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
11531 CHECK(calls->handle_revoke_and_ack_meth != NULL);
11532 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
11533 CHECK(calls->handle_update_fee_meth != NULL);
11534 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
11535 CHECK(calls->handle_announcement_signatures_meth != NULL);
11536 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
11537 CHECK(calls->peer_disconnected_meth != NULL);
11538 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
11539 CHECK(calls->peer_connected_meth != NULL);
11540 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
11541 CHECK(calls->handle_channel_reestablish_meth != NULL);
11542 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
11543 CHECK(calls->handle_channel_update_meth != NULL);
11544 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
11545 CHECK(calls->handle_error_meth != NULL);
11547 LDKChannelMessageHandler ret = {
11548 .this_arg = (void*) calls,
11549 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
11550 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
11551 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
11552 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
11553 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
11554 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
11555 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
11556 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
11557 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
11558 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
11559 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
11560 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
11561 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
11562 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
11563 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
11564 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
11565 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
11566 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
11567 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
11568 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
11569 .free = LDKChannelMessageHandler_JCalls_free,
11570 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
11572 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
11575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11576 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11577 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
11578 return (uint64_t)res_ptr;
11580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
11581 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
11582 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
11583 DO_ASSERT((res_ptr & 1) == 0);
11584 return (int64_t)(res_ptr | 1);
11586 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) {
11587 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11588 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11589 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11590 LDKPublicKey their_node_id_ref;
11591 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11592 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11593 LDKInitFeatures their_features_conv;
11594 their_features_conv.inner = (void*)(their_features & (~1));
11595 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
11596 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11597 their_features_conv = InitFeatures_clone(&their_features_conv);
11598 LDKOpenChannel msg_conv;
11599 msg_conv.inner = (void*)(msg & (~1));
11600 msg_conv.is_owned = false;
11601 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11602 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11605 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) {
11606 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11607 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11608 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11609 LDKPublicKey their_node_id_ref;
11610 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11611 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11612 LDKInitFeatures their_features_conv;
11613 their_features_conv.inner = (void*)(their_features & (~1));
11614 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
11615 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11616 their_features_conv = InitFeatures_clone(&their_features_conv);
11617 LDKAcceptChannel msg_conv;
11618 msg_conv.inner = (void*)(msg & (~1));
11619 msg_conv.is_owned = false;
11620 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11621 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11624 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) {
11625 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11626 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11627 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11628 LDKPublicKey their_node_id_ref;
11629 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11630 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11631 LDKFundingCreated msg_conv;
11632 msg_conv.inner = (void*)(msg & (~1));
11633 msg_conv.is_owned = false;
11634 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11635 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11638 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) {
11639 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11640 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11641 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11642 LDKPublicKey their_node_id_ref;
11643 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11644 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11645 LDKFundingSigned msg_conv;
11646 msg_conv.inner = (void*)(msg & (~1));
11647 msg_conv.is_owned = false;
11648 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11649 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11652 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) {
11653 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11654 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11655 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11656 LDKPublicKey their_node_id_ref;
11657 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11658 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11659 LDKFundingLocked msg_conv;
11660 msg_conv.inner = (void*)(msg & (~1));
11661 msg_conv.is_owned = false;
11662 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11663 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11666 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) {
11667 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11668 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11669 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11670 LDKPublicKey their_node_id_ref;
11671 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11672 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11673 LDKInitFeatures their_features_conv;
11674 their_features_conv.inner = (void*)(their_features & (~1));
11675 their_features_conv.is_owned = false;
11676 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11677 LDKShutdown msg_conv;
11678 msg_conv.inner = (void*)(msg & (~1));
11679 msg_conv.is_owned = false;
11680 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11681 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
11684 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) {
11685 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11686 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11687 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11688 LDKPublicKey their_node_id_ref;
11689 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11690 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11691 LDKClosingSigned msg_conv;
11692 msg_conv.inner = (void*)(msg & (~1));
11693 msg_conv.is_owned = false;
11694 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11695 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11698 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) {
11699 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11700 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11701 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11702 LDKPublicKey their_node_id_ref;
11703 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11704 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11705 LDKUpdateAddHTLC msg_conv;
11706 msg_conv.inner = (void*)(msg & (~1));
11707 msg_conv.is_owned = false;
11708 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11709 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11712 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) {
11713 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11714 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11715 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11716 LDKPublicKey their_node_id_ref;
11717 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11718 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11719 LDKUpdateFulfillHTLC msg_conv;
11720 msg_conv.inner = (void*)(msg & (~1));
11721 msg_conv.is_owned = false;
11722 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11723 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11726 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) {
11727 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11728 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11729 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11730 LDKPublicKey their_node_id_ref;
11731 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11732 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11733 LDKUpdateFailHTLC msg_conv;
11734 msg_conv.inner = (void*)(msg & (~1));
11735 msg_conv.is_owned = false;
11736 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11737 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11740 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) {
11741 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11742 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11743 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11744 LDKPublicKey their_node_id_ref;
11745 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11746 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11747 LDKUpdateFailMalformedHTLC msg_conv;
11748 msg_conv.inner = (void*)(msg & (~1));
11749 msg_conv.is_owned = false;
11750 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11751 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11754 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) {
11755 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11756 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11757 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11758 LDKPublicKey their_node_id_ref;
11759 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11760 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11761 LDKCommitmentSigned msg_conv;
11762 msg_conv.inner = (void*)(msg & (~1));
11763 msg_conv.is_owned = false;
11764 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11765 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11768 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) {
11769 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11770 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11771 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11772 LDKPublicKey their_node_id_ref;
11773 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11774 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11775 LDKRevokeAndACK msg_conv;
11776 msg_conv.inner = (void*)(msg & (~1));
11777 msg_conv.is_owned = false;
11778 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11779 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11782 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) {
11783 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11784 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11785 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11786 LDKPublicKey their_node_id_ref;
11787 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11788 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11789 LDKUpdateFee msg_conv;
11790 msg_conv.inner = (void*)(msg & (~1));
11791 msg_conv.is_owned = false;
11792 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11793 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11796 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) {
11797 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11798 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11799 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11800 LDKPublicKey their_node_id_ref;
11801 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11802 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11803 LDKAnnouncementSignatures msg_conv;
11804 msg_conv.inner = (void*)(msg & (~1));
11805 msg_conv.is_owned = false;
11806 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11807 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11810 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) {
11811 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11812 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11813 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11814 LDKPublicKey their_node_id_ref;
11815 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11816 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11817 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
11820 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) {
11821 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11822 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11823 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11824 LDKPublicKey their_node_id_ref;
11825 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11826 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11828 msg_conv.inner = (void*)(msg & (~1));
11829 msg_conv.is_owned = false;
11830 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11831 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11834 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) {
11835 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11836 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11837 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11838 LDKPublicKey their_node_id_ref;
11839 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11840 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11841 LDKChannelReestablish msg_conv;
11842 msg_conv.inner = (void*)(msg & (~1));
11843 msg_conv.is_owned = false;
11844 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11845 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11848 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) {
11849 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11850 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11851 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11852 LDKPublicKey their_node_id_ref;
11853 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11854 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11855 LDKChannelUpdate msg_conv;
11856 msg_conv.inner = (void*)(msg & (~1));
11857 msg_conv.is_owned = false;
11858 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11859 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11862 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) {
11863 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11864 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11865 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11866 LDKPublicKey their_node_id_ref;
11867 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11868 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11869 LDKErrorMessage msg_conv;
11870 msg_conv.inner = (void*)(msg & (~1));
11871 msg_conv.is_owned = false;
11872 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11873 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11876 typedef struct LDKRoutingMessageHandler_JCalls {
11877 atomic_size_t refcnt;
11880 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11881 jmethodID handle_node_announcement_meth;
11882 jmethodID handle_channel_announcement_meth;
11883 jmethodID handle_channel_update_meth;
11884 jmethodID get_next_channel_announcements_meth;
11885 jmethodID get_next_node_announcements_meth;
11886 jmethodID peer_connected_meth;
11887 jmethodID handle_reply_channel_range_meth;
11888 jmethodID handle_reply_short_channel_ids_end_meth;
11889 jmethodID handle_query_channel_range_meth;
11890 jmethodID handle_query_short_channel_ids_meth;
11891 } LDKRoutingMessageHandler_JCalls;
11892 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
11893 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11894 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11896 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11897 if (get_jenv_res == JNI_EDETACHED) {
11898 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11900 DO_ASSERT(get_jenv_res == JNI_OK);
11902 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11903 if (get_jenv_res == JNI_EDETACHED) {
11904 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11909 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
11910 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11912 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11913 if (get_jenv_res == JNI_EDETACHED) {
11914 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11916 DO_ASSERT(get_jenv_res == JNI_OK);
11918 LDKNodeAnnouncement msg_var = *msg;
11919 int64_t msg_ref = 0;
11920 msg_var = NodeAnnouncement_clone(&msg_var);
11921 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11922 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11923 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11924 msg_ref = (uintptr_t)msg_var.inner;
11925 if (msg_var.is_owned) {
11928 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11929 CHECK(obj != NULL);
11930 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
11931 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11932 (*env)->ExceptionDescribe(env);
11933 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11935 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11936 CHECK_ACCESS(ret_ptr);
11937 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11939 if (get_jenv_res == JNI_EDETACHED) {
11940 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11944 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
11945 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11947 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11948 if (get_jenv_res == JNI_EDETACHED) {
11949 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11951 DO_ASSERT(get_jenv_res == JNI_OK);
11953 LDKChannelAnnouncement msg_var = *msg;
11954 int64_t msg_ref = 0;
11955 msg_var = ChannelAnnouncement_clone(&msg_var);
11956 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11957 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11958 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11959 msg_ref = (uintptr_t)msg_var.inner;
11960 if (msg_var.is_owned) {
11963 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11964 CHECK(obj != NULL);
11965 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
11966 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11967 (*env)->ExceptionDescribe(env);
11968 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11970 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11971 CHECK_ACCESS(ret_ptr);
11972 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11974 if (get_jenv_res == JNI_EDETACHED) {
11975 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11979 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
11980 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11982 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11983 if (get_jenv_res == JNI_EDETACHED) {
11984 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11986 DO_ASSERT(get_jenv_res == JNI_OK);
11988 LDKChannelUpdate msg_var = *msg;
11989 int64_t msg_ref = 0;
11990 msg_var = ChannelUpdate_clone(&msg_var);
11991 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11992 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11993 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11994 msg_ref = (uintptr_t)msg_var.inner;
11995 if (msg_var.is_owned) {
11998 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11999 CHECK(obj != NULL);
12000 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
12001 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12002 (*env)->ExceptionDescribe(env);
12003 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
12005 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12006 CHECK_ACCESS(ret_ptr);
12007 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12009 if (get_jenv_res == JNI_EDETACHED) {
12010 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12014 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
12015 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12017 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12018 if (get_jenv_res == JNI_EDETACHED) {
12019 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12021 DO_ASSERT(get_jenv_res == JNI_OK);
12023 int64_t starting_point_conv = starting_point;
12024 int8_t batch_amount_conv = batch_amount;
12025 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12026 CHECK(obj != NULL);
12027 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point_conv, batch_amount_conv);
12028 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12029 (*env)->ExceptionDescribe(env);
12030 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12032 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
12033 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12034 if (ret_constr.datalen > 0)
12035 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
12037 ret_constr.data = NULL;
12038 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12039 for (size_t h = 0; h < ret_constr.datalen; h++) {
12040 int64_t ret_conv_59 = ret_vals[h];
12041 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
12042 CHECK_ACCESS(ret_conv_59_ptr);
12043 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
12044 FREE((void*)ret_conv_59);
12045 ret_constr.data[h] = ret_conv_59_conv;
12047 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12048 if (get_jenv_res == JNI_EDETACHED) {
12049 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12053 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
12054 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12056 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12057 if (get_jenv_res == JNI_EDETACHED) {
12058 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12060 DO_ASSERT(get_jenv_res == JNI_OK);
12062 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
12063 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
12064 int8_t batch_amount_conv = batch_amount;
12065 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12066 CHECK(obj != NULL);
12067 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount_conv);
12068 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12069 (*env)->ExceptionDescribe(env);
12070 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
12072 LDKCVec_NodeAnnouncementZ ret_constr;
12073 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12074 if (ret_constr.datalen > 0)
12075 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
12077 ret_constr.data = NULL;
12078 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12079 for (size_t s = 0; s < ret_constr.datalen; s++) {
12080 int64_t ret_conv_18 = ret_vals[s];
12081 LDKNodeAnnouncement ret_conv_18_conv;
12082 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
12083 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
12084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
12085 ret_constr.data[s] = ret_conv_18_conv;
12087 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12088 if (get_jenv_res == JNI_EDETACHED) {
12089 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12093 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
12094 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12096 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12097 if (get_jenv_res == JNI_EDETACHED) {
12098 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12100 DO_ASSERT(get_jenv_res == JNI_OK);
12102 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12103 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12104 LDKInit init_var = *init;
12105 int64_t init_ref = 0;
12106 init_var = Init_clone(&init_var);
12107 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12108 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12109 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
12110 init_ref = (uintptr_t)init_var.inner;
12111 if (init_var.is_owned) {
12114 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12115 CHECK(obj != NULL);
12116 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref);
12117 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12118 (*env)->ExceptionDescribe(env);
12119 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
12121 if (get_jenv_res == JNI_EDETACHED) {
12122 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12125 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
12126 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12128 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12129 if (get_jenv_res == JNI_EDETACHED) {
12130 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12132 DO_ASSERT(get_jenv_res == JNI_OK);
12134 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12135 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12136 LDKReplyChannelRange msg_var = msg;
12137 int64_t msg_ref = 0;
12138 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12139 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12140 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12141 msg_ref = (uintptr_t)msg_var.inner;
12142 if (msg_var.is_owned) {
12145 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12146 CHECK(obj != NULL);
12147 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
12148 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12149 (*env)->ExceptionDescribe(env);
12150 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12152 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12153 CHECK_ACCESS(ret_ptr);
12154 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12156 if (get_jenv_res == JNI_EDETACHED) {
12157 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12161 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
12162 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12164 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12165 if (get_jenv_res == JNI_EDETACHED) {
12166 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12168 DO_ASSERT(get_jenv_res == JNI_OK);
12170 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12171 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12172 LDKReplyShortChannelIdsEnd msg_var = msg;
12173 int64_t msg_ref = 0;
12174 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12175 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12176 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12177 msg_ref = (uintptr_t)msg_var.inner;
12178 if (msg_var.is_owned) {
12181 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12182 CHECK(obj != NULL);
12183 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
12184 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12185 (*env)->ExceptionDescribe(env);
12186 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
12188 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12189 CHECK_ACCESS(ret_ptr);
12190 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12192 if (get_jenv_res == JNI_EDETACHED) {
12193 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12197 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
12198 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12200 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12201 if (get_jenv_res == JNI_EDETACHED) {
12202 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12204 DO_ASSERT(get_jenv_res == JNI_OK);
12206 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12207 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12208 LDKQueryChannelRange msg_var = msg;
12209 int64_t msg_ref = 0;
12210 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12211 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12212 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12213 msg_ref = (uintptr_t)msg_var.inner;
12214 if (msg_var.is_owned) {
12217 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12218 CHECK(obj != NULL);
12219 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
12220 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12221 (*env)->ExceptionDescribe(env);
12222 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
12224 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12225 CHECK_ACCESS(ret_ptr);
12226 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12228 if (get_jenv_res == JNI_EDETACHED) {
12229 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12233 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
12234 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12236 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12237 if (get_jenv_res == JNI_EDETACHED) {
12238 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12240 DO_ASSERT(get_jenv_res == JNI_OK);
12242 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
12243 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
12244 LDKQueryShortChannelIds msg_var = msg;
12245 int64_t msg_ref = 0;
12246 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12247 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12248 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12249 msg_ref = (uintptr_t)msg_var.inner;
12250 if (msg_var.is_owned) {
12253 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12254 CHECK(obj != NULL);
12255 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
12256 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12257 (*env)->ExceptionDescribe(env);
12258 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
12260 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12261 CHECK_ACCESS(ret_ptr);
12262 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12264 if (get_jenv_res == JNI_EDETACHED) {
12265 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12269 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
12270 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
12271 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12272 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12274 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12275 jclass c = (*env)->GetObjectClass(env, o);
12277 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
12278 atomic_init(&calls->refcnt, 1);
12279 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12280 calls->o = (*env)->NewWeakGlobalRef(env, o);
12281 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
12282 CHECK(calls->handle_node_announcement_meth != NULL);
12283 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
12284 CHECK(calls->handle_channel_announcement_meth != NULL);
12285 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
12286 CHECK(calls->handle_channel_update_meth != NULL);
12287 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
12288 CHECK(calls->get_next_channel_announcements_meth != NULL);
12289 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
12290 CHECK(calls->get_next_node_announcements_meth != NULL);
12291 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
12292 CHECK(calls->peer_connected_meth != NULL);
12293 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
12294 CHECK(calls->handle_reply_channel_range_meth != NULL);
12295 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
12296 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
12297 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
12298 CHECK(calls->handle_query_channel_range_meth != NULL);
12299 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
12300 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
12302 LDKRoutingMessageHandler ret = {
12303 .this_arg = (void*) calls,
12304 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
12305 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
12306 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
12307 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
12308 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
12309 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
12310 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
12311 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
12312 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
12313 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
12314 .free = LDKRoutingMessageHandler_JCalls_free,
12315 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
12317 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
12321 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12322 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
12323 return (uint64_t)res_ptr;
12325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
12326 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
12327 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
12328 DO_ASSERT((res_ptr & 1) == 0);
12329 return (int64_t)(res_ptr | 1);
12331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12332 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12333 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12334 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12335 LDKNodeAnnouncement msg_conv;
12336 msg_conv.inner = (void*)(msg & (~1));
12337 msg_conv.is_owned = false;
12338 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12339 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12340 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
12341 return (int64_t)ret_conv;
12344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12345 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12346 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12347 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12348 LDKChannelAnnouncement msg_conv;
12349 msg_conv.inner = (void*)(msg & (~1));
12350 msg_conv.is_owned = false;
12351 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12352 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12353 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
12354 return (int64_t)ret_conv;
12357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12358 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12359 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12360 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12361 LDKChannelUpdate msg_conv;
12362 msg_conv.inner = (void*)(msg & (~1));
12363 msg_conv.is_owned = false;
12364 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12365 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12366 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
12367 return (int64_t)ret_conv;
12370 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) {
12371 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12372 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12373 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12374 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
12375 int64_tArray ret_arr = NULL;
12376 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12377 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12378 for (size_t h = 0; h < ret_var.datalen; h++) {
12379 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
12380 *ret_conv_59_conv = ret_var.data[h];
12381 ret_arr_ptr[h] = ((int64_t)ret_conv_59_conv);
12383 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12384 FREE(ret_var.data);
12388 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) {
12389 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12390 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12391 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12392 LDKPublicKey starting_point_ref;
12393 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
12394 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
12395 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
12396 int64_tArray ret_arr = NULL;
12397 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12398 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12399 for (size_t s = 0; s < ret_var.datalen; s++) {
12400 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
12401 int64_t ret_conv_18_ref = 0;
12402 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12403 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12404 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
12405 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
12406 if (ret_conv_18_var.is_owned) {
12407 ret_conv_18_ref |= 1;
12409 ret_arr_ptr[s] = ret_conv_18_ref;
12411 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12412 FREE(ret_var.data);
12416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
12417 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12418 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12419 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12420 LDKPublicKey their_node_id_ref;
12421 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12422 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12424 init_conv.inner = (void*)(init & (~1));
12425 init_conv.is_owned = false;
12426 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
12427 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
12430 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) {
12431 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12432 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12433 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12434 LDKPublicKey their_node_id_ref;
12435 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12436 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12437 LDKReplyChannelRange msg_conv;
12438 msg_conv.inner = (void*)(msg & (~1));
12439 msg_conv.is_owned = (msg & 1) || (msg == 0);
12440 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12441 msg_conv = ReplyChannelRange_clone(&msg_conv);
12442 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12443 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12444 return (int64_t)ret_conv;
12447 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) {
12448 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12449 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12450 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12451 LDKPublicKey their_node_id_ref;
12452 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12453 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12454 LDKReplyShortChannelIdsEnd msg_conv;
12455 msg_conv.inner = (void*)(msg & (~1));
12456 msg_conv.is_owned = (msg & 1) || (msg == 0);
12457 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12458 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
12459 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12460 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12461 return (int64_t)ret_conv;
12464 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) {
12465 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12466 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12467 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12468 LDKPublicKey their_node_id_ref;
12469 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12470 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12471 LDKQueryChannelRange msg_conv;
12472 msg_conv.inner = (void*)(msg & (~1));
12473 msg_conv.is_owned = (msg & 1) || (msg == 0);
12474 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12475 msg_conv = QueryChannelRange_clone(&msg_conv);
12476 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12477 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12478 return (int64_t)ret_conv;
12481 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) {
12482 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12483 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12484 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12485 LDKPublicKey their_node_id_ref;
12486 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12487 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12488 LDKQueryShortChannelIds msg_conv;
12489 msg_conv.inner = (void*)(msg & (~1));
12490 msg_conv.is_owned = (msg & 1) || (msg == 0);
12491 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12492 msg_conv = QueryShortChannelIds_clone(&msg_conv);
12493 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12494 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12495 return (int64_t)ret_conv;
12498 typedef struct LDKCustomMessageReader_JCalls {
12499 atomic_size_t refcnt;
12502 jmethodID read_meth;
12503 } LDKCustomMessageReader_JCalls;
12504 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
12505 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12506 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12508 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12509 if (get_jenv_res == JNI_EDETACHED) {
12510 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12512 DO_ASSERT(get_jenv_res == JNI_OK);
12514 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12515 if (get_jenv_res == JNI_EDETACHED) {
12516 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12521 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
12522 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12524 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12525 if (get_jenv_res == JNI_EDETACHED) {
12526 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12528 DO_ASSERT(get_jenv_res == JNI_OK);
12530 int16_t message_type_conv = message_type;
12531 LDKu8slice buffer_var = buffer;
12532 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
12533 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
12534 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12535 CHECK(obj != NULL);
12536 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
12537 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12538 (*env)->ExceptionDescribe(env);
12539 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
12541 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12542 CHECK_ACCESS(ret_ptr);
12543 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
12545 if (get_jenv_res == JNI_EDETACHED) {
12546 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12550 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
12551 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
12552 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12554 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
12555 jclass c = (*env)->GetObjectClass(env, o);
12557 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
12558 atomic_init(&calls->refcnt, 1);
12559 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12560 calls->o = (*env)->NewWeakGlobalRef(env, o);
12561 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
12562 CHECK(calls->read_meth != NULL);
12564 LDKCustomMessageReader ret = {
12565 .this_arg = (void*) calls,
12566 .read = read_LDKCustomMessageReader_jcall,
12567 .free = LDKCustomMessageReader_JCalls_free,
12571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
12572 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
12573 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
12574 return (uint64_t)res_ptr;
12576 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) {
12577 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12578 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12579 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
12580 LDKu8slice buffer_ref;
12581 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
12582 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
12583 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12584 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
12585 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
12586 return (int64_t)ret_conv;
12589 typedef struct LDKCustomMessageHandler_JCalls {
12590 atomic_size_t refcnt;
12593 LDKCustomMessageReader_JCalls* CustomMessageReader;
12594 jmethodID handle_custom_message_meth;
12595 jmethodID get_and_clear_pending_msg_meth;
12596 } LDKCustomMessageHandler_JCalls;
12597 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
12598 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12599 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12601 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12602 if (get_jenv_res == JNI_EDETACHED) {
12603 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12605 DO_ASSERT(get_jenv_res == JNI_OK);
12607 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12608 if (get_jenv_res == JNI_EDETACHED) {
12609 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12614 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
12615 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12617 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12618 if (get_jenv_res == JNI_EDETACHED) {
12619 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12621 DO_ASSERT(get_jenv_res == JNI_OK);
12623 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
12625 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
12626 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
12627 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12628 CHECK(obj != NULL);
12629 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (int64_t)msg_ret, sender_node_id_arr);
12630 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12631 (*env)->ExceptionDescribe(env);
12632 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
12634 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12635 CHECK_ACCESS(ret_ptr);
12636 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12638 if (get_jenv_res == JNI_EDETACHED) {
12639 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12643 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
12644 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12646 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12647 if (get_jenv_res == JNI_EDETACHED) {
12648 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12650 DO_ASSERT(get_jenv_res == JNI_OK);
12652 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12653 CHECK(obj != NULL);
12654 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
12655 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12656 (*env)->ExceptionDescribe(env);
12657 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
12659 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
12660 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12661 if (ret_constr.datalen > 0)
12662 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
12664 ret_constr.data = NULL;
12665 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12666 for (size_t z = 0; z < ret_constr.datalen; z++) {
12667 int64_t ret_conv_25 = ret_vals[z];
12668 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
12669 CHECK_ACCESS(ret_conv_25_ptr);
12670 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
12671 FREE((void*)ret_conv_25);
12672 ret_constr.data[z] = ret_conv_25_conv;
12674 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12675 if (get_jenv_res == JNI_EDETACHED) {
12676 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12680 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
12681 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
12682 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12683 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
12685 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12686 jclass c = (*env)->GetObjectClass(env, o);
12688 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
12689 atomic_init(&calls->refcnt, 1);
12690 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12691 calls->o = (*env)->NewWeakGlobalRef(env, o);
12692 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
12693 CHECK(calls->handle_custom_message_meth != NULL);
12694 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
12695 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
12697 LDKCustomMessageHandler ret = {
12698 .this_arg = (void*) calls,
12699 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
12700 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
12701 .free = LDKCustomMessageHandler_JCalls_free,
12702 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
12704 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
12707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12708 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
12709 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
12710 return (uint64_t)res_ptr;
12712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
12713 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
12714 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
12715 DO_ASSERT((res_ptr & 1) == 0);
12716 return (int64_t)(res_ptr | 1);
12718 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) {
12719 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12720 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12721 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12722 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
12723 CHECK_ACCESS(msg_ptr);
12724 LDKType msg_conv = *(LDKType*)(msg_ptr);
12725 if (msg_conv.free == LDKType_JCalls_free) {
12726 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12727 LDKType_JCalls_cloned(&msg_conv);
12729 LDKPublicKey sender_node_id_ref;
12730 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
12731 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
12732 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12733 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
12734 return (int64_t)ret_conv;
12737 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
12738 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12739 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12740 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12741 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
12742 int64_tArray ret_arr = NULL;
12743 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12744 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12745 for (size_t z = 0; z < ret_var.datalen; z++) {
12746 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12747 *ret_conv_25_conv = ret_var.data[z];
12748 ret_arr_ptr[z] = ((int64_t)ret_conv_25_conv);
12750 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12751 FREE(ret_var.data);
12755 typedef struct LDKSocketDescriptor_JCalls {
12756 atomic_size_t refcnt;
12759 jmethodID send_data_meth;
12760 jmethodID disconnect_socket_meth;
12762 jmethodID hash_meth;
12763 } LDKSocketDescriptor_JCalls;
12764 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
12765 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12766 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12768 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12769 if (get_jenv_res == JNI_EDETACHED) {
12770 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12772 DO_ASSERT(get_jenv_res == JNI_OK);
12774 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12775 if (get_jenv_res == JNI_EDETACHED) {
12776 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12781 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
12782 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12784 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12785 if (get_jenv_res == JNI_EDETACHED) {
12786 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12788 DO_ASSERT(get_jenv_res == JNI_OK);
12790 LDKu8slice data_var = data;
12791 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
12792 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
12793 jboolean resume_read_conv = resume_read;
12794 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12795 CHECK(obj != NULL);
12796 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
12797 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12798 (*env)->ExceptionDescribe(env);
12799 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
12801 if (get_jenv_res == JNI_EDETACHED) {
12802 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12806 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
12807 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12809 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12810 if (get_jenv_res == JNI_EDETACHED) {
12811 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12813 DO_ASSERT(get_jenv_res == JNI_OK);
12815 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12816 CHECK(obj != NULL);
12817 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
12818 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12819 (*env)->ExceptionDescribe(env);
12820 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
12822 if (get_jenv_res == JNI_EDETACHED) {
12823 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12826 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
12827 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12829 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12830 if (get_jenv_res == JNI_EDETACHED) {
12831 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12833 DO_ASSERT(get_jenv_res == JNI_OK);
12835 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12836 *other_arg_clone = SocketDescriptor_clone(other_arg);
12837 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12838 CHECK(obj != NULL);
12839 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (int64_t)other_arg_clone);
12840 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12841 (*env)->ExceptionDescribe(env);
12842 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
12844 if (get_jenv_res == JNI_EDETACHED) {
12845 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12849 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
12850 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12852 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12853 if (get_jenv_res == JNI_EDETACHED) {
12854 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12856 DO_ASSERT(get_jenv_res == JNI_OK);
12858 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12859 CHECK(obj != NULL);
12860 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
12861 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12862 (*env)->ExceptionDescribe(env);
12863 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
12865 if (get_jenv_res == JNI_EDETACHED) {
12866 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12870 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
12871 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
12872 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12874 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
12875 jclass c = (*env)->GetObjectClass(env, o);
12877 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
12878 atomic_init(&calls->refcnt, 1);
12879 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12880 calls->o = (*env)->NewWeakGlobalRef(env, o);
12881 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
12882 CHECK(calls->send_data_meth != NULL);
12883 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
12884 CHECK(calls->disconnect_socket_meth != NULL);
12885 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
12886 CHECK(calls->eq_meth != NULL);
12887 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
12888 CHECK(calls->hash_meth != NULL);
12890 LDKSocketDescriptor ret = {
12891 .this_arg = (void*) calls,
12892 .send_data = send_data_LDKSocketDescriptor_jcall,
12893 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
12894 .eq = eq_LDKSocketDescriptor_jcall,
12895 .hash = hash_LDKSocketDescriptor_jcall,
12896 .cloned = LDKSocketDescriptor_JCalls_cloned,
12897 .free = LDKSocketDescriptor_JCalls_free,
12901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
12902 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12903 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
12904 return (uint64_t)res_ptr;
12906 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) {
12907 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12908 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12909 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12910 LDKu8slice data_ref;
12911 data_ref.datalen = (*env)->GetArrayLength(env, data);
12912 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
12913 int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
12914 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
12918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
12919 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12920 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12921 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12922 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
12925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
12926 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12927 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12928 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12929 int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
12933 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
12934 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
12935 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
12936 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
12937 static jclass LDKEffectiveCapacity_Total_class = NULL;
12938 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
12939 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
12940 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
12941 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
12942 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
12943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
12944 LDKEffectiveCapacity_ExactLiquidity_class =
12945 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
12946 CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
12947 LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
12948 CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
12949 LDKEffectiveCapacity_MaximumHTLC_class =
12950 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
12951 CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
12952 LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
12953 CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
12954 LDKEffectiveCapacity_Total_class =
12955 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
12956 CHECK(LDKEffectiveCapacity_Total_class != NULL);
12957 LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(J)V");
12958 CHECK(LDKEffectiveCapacity_Total_meth != NULL);
12959 LDKEffectiveCapacity_Infinite_class =
12960 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
12961 CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
12962 LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
12963 CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
12964 LDKEffectiveCapacity_Unknown_class =
12965 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
12966 CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
12967 LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
12968 CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
12970 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12971 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
12973 case LDKEffectiveCapacity_ExactLiquidity: {
12974 int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
12975 return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
12977 case LDKEffectiveCapacity_MaximumHTLC: {
12978 int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
12979 return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, amount_msat_conv);
12981 case LDKEffectiveCapacity_Total: {
12982 int64_t capacity_msat_conv = obj->total.capacity_msat;
12983 return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv);
12985 case LDKEffectiveCapacity_Infinite: {
12986 return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
12988 case LDKEffectiveCapacity_Unknown: {
12989 return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
12994 typedef struct LDKScore_JCalls {
12995 atomic_size_t refcnt;
12998 jmethodID channel_penalty_msat_meth;
12999 jmethodID payment_path_failed_meth;
13000 jmethodID payment_path_successful_meth;
13001 jmethodID write_meth;
13003 static void LDKScore_JCalls_free(void* this_arg) {
13004 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
13005 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13007 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13008 if (get_jenv_res == JNI_EDETACHED) {
13009 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13011 DO_ASSERT(get_jenv_res == JNI_OK);
13013 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13014 if (get_jenv_res == JNI_EDETACHED) {
13015 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13020 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const LDKNodeId * source, const LDKNodeId * target) {
13021 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
13023 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13024 if (get_jenv_res == JNI_EDETACHED) {
13025 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13027 DO_ASSERT(get_jenv_res == JNI_OK);
13029 int64_t short_channel_id_conv = short_channel_id;
13030 int64_t send_amt_msat_conv = send_amt_msat;
13031 int64_t capacity_msat_conv = capacity_msat;
13032 LDKNodeId source_var = *source;
13033 int64_t source_ref = 0;
13034 source_var = NodeId_clone(&source_var);
13035 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13036 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13037 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
13038 source_ref = (uintptr_t)source_var.inner;
13039 if (source_var.is_owned) {
13042 LDKNodeId target_var = *target;
13043 int64_t target_ref = 0;
13044 target_var = NodeId_clone(&target_var);
13045 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13046 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13047 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
13048 target_ref = (uintptr_t)target_var.inner;
13049 if (target_var.is_owned) {
13052 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13053 CHECK(obj != NULL);
13054 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id_conv, send_amt_msat_conv, capacity_msat_conv, source_ref, target_ref);
13055 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13056 (*env)->ExceptionDescribe(env);
13057 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
13059 if (get_jenv_res == JNI_EDETACHED) {
13060 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13064 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
13065 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
13067 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13068 if (get_jenv_res == JNI_EDETACHED) {
13069 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13071 DO_ASSERT(get_jenv_res == JNI_OK);
13073 LDKCVec_RouteHopZ path_var = path;
13074 int64_tArray path_arr = NULL;
13075 path_arr = (*env)->NewLongArray(env, path_var.datalen);
13076 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
13077 for (size_t k = 0; k < path_var.datalen; k++) {
13078 LDKRouteHop path_conv_10_var = path_var.data[k];
13079 int64_t path_conv_10_ref = 0;
13080 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13081 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13082 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
13083 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
13084 if (path_conv_10_var.is_owned) {
13085 path_conv_10_ref |= 1;
13087 path_arr_ptr[k] = path_conv_10_ref;
13089 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
13090 FREE(path_var.data);
13091 int64_t short_channel_id_conv = short_channel_id;
13092 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13093 CHECK(obj != NULL);
13094 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id_conv);
13095 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13096 (*env)->ExceptionDescribe(env);
13097 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
13099 if (get_jenv_res == JNI_EDETACHED) {
13100 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13103 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
13104 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
13106 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13107 if (get_jenv_res == JNI_EDETACHED) {
13108 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13110 DO_ASSERT(get_jenv_res == JNI_OK);
13112 LDKCVec_RouteHopZ path_var = path;
13113 int64_tArray path_arr = NULL;
13114 path_arr = (*env)->NewLongArray(env, path_var.datalen);
13115 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
13116 for (size_t k = 0; k < path_var.datalen; k++) {
13117 LDKRouteHop path_conv_10_var = path_var.data[k];
13118 int64_t path_conv_10_ref = 0;
13119 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13120 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13121 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
13122 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
13123 if (path_conv_10_var.is_owned) {
13124 path_conv_10_ref |= 1;
13126 path_arr_ptr[k] = path_conv_10_ref;
13128 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
13129 FREE(path_var.data);
13130 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13131 CHECK(obj != NULL);
13132 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
13133 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13134 (*env)->ExceptionDescribe(env);
13135 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
13137 if (get_jenv_res == JNI_EDETACHED) {
13138 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13141 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
13142 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
13144 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13145 if (get_jenv_res == JNI_EDETACHED) {
13146 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13148 DO_ASSERT(get_jenv_res == JNI_OK);
13150 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13151 CHECK(obj != NULL);
13152 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
13153 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13154 (*env)->ExceptionDescribe(env);
13155 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
13157 LDKCVec_u8Z ret_ref;
13158 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
13159 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
13160 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
13161 if (get_jenv_res == JNI_EDETACHED) {
13162 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13166 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
13167 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
13168 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13170 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
13171 jclass c = (*env)->GetObjectClass(env, o);
13173 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
13174 atomic_init(&calls->refcnt, 1);
13175 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13176 calls->o = (*env)->NewWeakGlobalRef(env, o);
13177 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
13178 CHECK(calls->channel_penalty_msat_meth != NULL);
13179 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
13180 CHECK(calls->payment_path_failed_meth != NULL);
13181 calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
13182 CHECK(calls->payment_path_successful_meth != NULL);
13183 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
13184 CHECK(calls->write_meth != NULL);
13187 .this_arg = (void*) calls,
13188 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
13189 .payment_path_failed = payment_path_failed_LDKScore_jcall,
13190 .payment_path_successful = payment_path_successful_LDKScore_jcall,
13191 .write = write_LDKScore_jcall,
13192 .free = LDKScore_JCalls_free,
13196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
13197 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
13198 *res_ptr = LDKScore_init(env, clz, o);
13199 return (uint64_t)res_ptr;
13201 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 capacity_msat, int64_t source, int64_t target) {
13202 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13203 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13204 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
13205 LDKNodeId source_conv;
13206 source_conv.inner = (void*)(source & (~1));
13207 source_conv.is_owned = false;
13208 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
13209 LDKNodeId target_conv;
13210 target_conv.inner = (void*)(target & (~1));
13211 target_conv.is_owned = false;
13212 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
13213 int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, capacity_msat, &source_conv, &target_conv);
13217 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) {
13218 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13219 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13220 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
13221 LDKCVec_RouteHopZ path_constr;
13222 path_constr.datalen = (*env)->GetArrayLength(env, path);
13223 if (path_constr.datalen > 0)
13224 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13226 path_constr.data = NULL;
13227 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
13228 for (size_t k = 0; k < path_constr.datalen; k++) {
13229 int64_t path_conv_10 = path_vals[k];
13230 LDKRouteHop path_conv_10_conv;
13231 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
13232 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
13233 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
13234 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
13235 path_constr.data[k] = path_conv_10_conv;
13237 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
13238 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
13241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
13242 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13243 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13244 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
13245 LDKCVec_RouteHopZ path_constr;
13246 path_constr.datalen = (*env)->GetArrayLength(env, path);
13247 if (path_constr.datalen > 0)
13248 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13250 path_constr.data = NULL;
13251 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
13252 for (size_t k = 0; k < path_constr.datalen; k++) {
13253 int64_t path_conv_10 = path_vals[k];
13254 LDKRouteHop path_conv_10_conv;
13255 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
13256 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
13257 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
13258 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
13259 path_constr.data[k] = path_conv_10_conv;
13261 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
13262 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
13265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
13266 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13267 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13268 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
13269 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
13270 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13271 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13272 CVec_u8Z_free(ret_var);
13276 typedef struct LDKLockableScore_JCalls {
13277 atomic_size_t refcnt;
13280 jmethodID lock_meth;
13281 } LDKLockableScore_JCalls;
13282 static void LDKLockableScore_JCalls_free(void* this_arg) {
13283 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13284 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13286 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13287 if (get_jenv_res == JNI_EDETACHED) {
13288 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13290 DO_ASSERT(get_jenv_res == JNI_OK);
13292 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13293 if (get_jenv_res == JNI_EDETACHED) {
13294 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13299 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
13300 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
13302 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13303 if (get_jenv_res == JNI_EDETACHED) {
13304 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13306 DO_ASSERT(get_jenv_res == JNI_OK);
13308 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13309 CHECK(obj != NULL);
13310 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
13311 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13312 (*env)->ExceptionDescribe(env);
13313 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
13315 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13316 CHECK_ACCESS(ret_ptr);
13317 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
13318 if (ret_conv.free == LDKScore_JCalls_free) {
13319 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13320 LDKScore_JCalls_cloned(&ret_conv);
13321 }// WARNING: we may need a move here but no clone is available for LDKScore
13323 if (get_jenv_res == JNI_EDETACHED) {
13324 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13328 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
13329 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
13330 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13332 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
13333 jclass c = (*env)->GetObjectClass(env, o);
13335 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
13336 atomic_init(&calls->refcnt, 1);
13337 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13338 calls->o = (*env)->NewWeakGlobalRef(env, o);
13339 calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
13340 CHECK(calls->lock_meth != NULL);
13342 LDKLockableScore ret = {
13343 .this_arg = (void*) calls,
13344 .lock = lock_LDKLockableScore_jcall,
13345 .free = LDKLockableScore_JCalls_free,
13349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
13350 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
13351 *res_ptr = LDKLockableScore_init(env, clz, o);
13352 return (uint64_t)res_ptr;
13354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
13355 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13356 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13357 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
13358 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
13359 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
13360 return (int64_t)ret_ret;
13363 typedef struct LDKPersister_JCalls {
13364 atomic_size_t refcnt;
13367 jmethodID persist_manager_meth;
13368 jmethodID persist_graph_meth;
13369 } LDKPersister_JCalls;
13370 static void LDKPersister_JCalls_free(void* this_arg) {
13371 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13372 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13374 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13375 if (get_jenv_res == JNI_EDETACHED) {
13376 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13378 DO_ASSERT(get_jenv_res == JNI_OK);
13380 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13381 if (get_jenv_res == JNI_EDETACHED) {
13382 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13387 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
13388 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13390 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13391 if (get_jenv_res == JNI_EDETACHED) {
13392 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13394 DO_ASSERT(get_jenv_res == JNI_OK);
13396 LDKChannelManager channel_manager_var = *channel_manager;
13397 int64_t channel_manager_ref = 0;
13398 // WARNING: we may need a move here but no clone is available for LDKChannelManager
13399 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13400 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13401 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
13402 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
13403 if (channel_manager_var.is_owned) {
13404 channel_manager_ref |= 1;
13406 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13407 CHECK(obj != NULL);
13408 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
13409 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13410 (*env)->ExceptionDescribe(env);
13411 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
13413 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13414 CHECK_ACCESS(ret_ptr);
13415 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13417 if (get_jenv_res == JNI_EDETACHED) {
13418 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13422 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
13423 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
13425 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13426 if (get_jenv_res == JNI_EDETACHED) {
13427 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13429 DO_ASSERT(get_jenv_res == JNI_OK);
13431 LDKNetworkGraph network_graph_var = *network_graph;
13432 int64_t network_graph_ref = 0;
13433 network_graph_var = NetworkGraph_clone(&network_graph_var);
13434 CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13435 CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13436 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
13437 network_graph_ref = (uintptr_t)network_graph_var.inner;
13438 if (network_graph_var.is_owned) {
13439 network_graph_ref |= 1;
13441 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13442 CHECK(obj != NULL);
13443 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
13444 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13445 (*env)->ExceptionDescribe(env);
13446 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
13448 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13449 CHECK_ACCESS(ret_ptr);
13450 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13452 if (get_jenv_res == JNI_EDETACHED) {
13453 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13457 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
13458 LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
13459 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13461 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
13462 jclass c = (*env)->GetObjectClass(env, o);
13464 LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
13465 atomic_init(&calls->refcnt, 1);
13466 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13467 calls->o = (*env)->NewWeakGlobalRef(env, o);
13468 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
13469 CHECK(calls->persist_manager_meth != NULL);
13470 calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
13471 CHECK(calls->persist_graph_meth != NULL);
13473 LDKPersister ret = {
13474 .this_arg = (void*) calls,
13475 .persist_manager = persist_manager_LDKPersister_jcall,
13476 .persist_graph = persist_graph_LDKPersister_jcall,
13477 .free = LDKPersister_JCalls_free,
13481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
13482 LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
13483 *res_ptr = LDKPersister_init(env, clz, o);
13484 return (uint64_t)res_ptr;
13486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
13487 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13488 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13489 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13490 LDKChannelManager channel_manager_conv;
13491 channel_manager_conv.inner = (void*)(channel_manager & (~1));
13492 channel_manager_conv.is_owned = false;
13493 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
13494 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
13495 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
13496 return (int64_t)ret_conv;
13499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
13500 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13501 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13502 LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
13503 LDKNetworkGraph network_graph_conv;
13504 network_graph_conv.inner = (void*)(network_graph & (~1));
13505 network_graph_conv.is_owned = false;
13506 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
13507 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
13508 *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
13509 return (int64_t)ret_conv;
13512 static jclass LDKFallback_SegWitProgram_class = NULL;
13513 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
13514 static jclass LDKFallback_PubKeyHash_class = NULL;
13515 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
13516 static jclass LDKFallback_ScriptHash_class = NULL;
13517 static jmethodID LDKFallback_ScriptHash_meth = NULL;
13518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
13519 LDKFallback_SegWitProgram_class =
13520 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
13521 CHECK(LDKFallback_SegWitProgram_class != NULL);
13522 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
13523 CHECK(LDKFallback_SegWitProgram_meth != NULL);
13524 LDKFallback_PubKeyHash_class =
13525 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
13526 CHECK(LDKFallback_PubKeyHash_class != NULL);
13527 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
13528 CHECK(LDKFallback_PubKeyHash_meth != NULL);
13529 LDKFallback_ScriptHash_class =
13530 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
13531 CHECK(LDKFallback_ScriptHash_class != NULL);
13532 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
13533 CHECK(LDKFallback_ScriptHash_meth != NULL);
13535 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13536 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
13538 case LDKFallback_SegWitProgram: {
13539 uint8_t version_val = obj->seg_wit_program.version._0;
13540 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
13541 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
13542 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
13543 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
13545 case LDKFallback_PubKeyHash: {
13546 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
13547 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
13548 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
13550 case LDKFallback_ScriptHash: {
13551 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
13552 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
13553 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
13558 typedef struct LDKPayer_JCalls {
13559 atomic_size_t refcnt;
13562 jmethodID node_id_meth;
13563 jmethodID first_hops_meth;
13564 jmethodID send_payment_meth;
13565 jmethodID send_spontaneous_payment_meth;
13566 jmethodID retry_payment_meth;
13567 jmethodID abandon_payment_meth;
13569 static void LDKPayer_JCalls_free(void* this_arg) {
13570 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13571 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13573 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13574 if (get_jenv_res == JNI_EDETACHED) {
13575 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13577 DO_ASSERT(get_jenv_res == JNI_OK);
13579 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13580 if (get_jenv_res == JNI_EDETACHED) {
13581 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13586 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
13587 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13589 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13590 if (get_jenv_res == JNI_EDETACHED) {
13591 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13593 DO_ASSERT(get_jenv_res == JNI_OK);
13595 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13596 CHECK(obj != NULL);
13597 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
13598 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13599 (*env)->ExceptionDescribe(env);
13600 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
13602 LDKPublicKey ret_ref;
13603 CHECK((*env)->GetArrayLength(env, ret) == 33);
13604 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
13605 if (get_jenv_res == JNI_EDETACHED) {
13606 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13610 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
13611 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13613 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13614 if (get_jenv_res == JNI_EDETACHED) {
13615 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13617 DO_ASSERT(get_jenv_res == JNI_OK);
13619 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13620 CHECK(obj != NULL);
13621 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
13622 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13623 (*env)->ExceptionDescribe(env);
13624 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
13626 LDKCVec_ChannelDetailsZ ret_constr;
13627 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13628 if (ret_constr.datalen > 0)
13629 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13631 ret_constr.data = NULL;
13632 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13633 for (size_t q = 0; q < ret_constr.datalen; q++) {
13634 int64_t ret_conv_16 = ret_vals[q];
13635 LDKChannelDetails ret_conv_16_conv;
13636 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
13637 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
13638 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
13639 ret_constr.data[q] = ret_conv_16_conv;
13641 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13642 if (get_jenv_res == JNI_EDETACHED) {
13643 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13647 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
13648 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13650 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13651 if (get_jenv_res == JNI_EDETACHED) {
13652 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13654 DO_ASSERT(get_jenv_res == JNI_OK);
13656 LDKRoute route_var = *route;
13657 int64_t route_ref = 0;
13658 route_var = Route_clone(&route_var);
13659 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13660 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13661 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13662 route_ref = (uintptr_t)route_var.inner;
13663 if (route_var.is_owned) {
13666 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13667 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
13668 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
13669 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
13670 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13671 CHECK(obj != NULL);
13672 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
13673 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13674 (*env)->ExceptionDescribe(env);
13675 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
13677 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13678 CHECK_ACCESS(ret_ptr);
13679 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13681 if (get_jenv_res == JNI_EDETACHED) {
13682 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13686 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
13687 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13689 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13690 if (get_jenv_res == JNI_EDETACHED) {
13691 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13693 DO_ASSERT(get_jenv_res == JNI_OK);
13695 LDKRoute route_var = *route;
13696 int64_t route_ref = 0;
13697 route_var = Route_clone(&route_var);
13698 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13699 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13700 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13701 route_ref = (uintptr_t)route_var.inner;
13702 if (route_var.is_owned) {
13705 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
13706 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
13707 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13708 CHECK(obj != NULL);
13709 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
13710 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13711 (*env)->ExceptionDescribe(env);
13712 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
13714 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13715 CHECK_ACCESS(ret_ptr);
13716 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13718 if (get_jenv_res == JNI_EDETACHED) {
13719 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13723 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
13724 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13726 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13727 if (get_jenv_res == JNI_EDETACHED) {
13728 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13730 DO_ASSERT(get_jenv_res == JNI_OK);
13732 LDKRoute route_var = *route;
13733 int64_t route_ref = 0;
13734 route_var = Route_clone(&route_var);
13735 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13736 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13737 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13738 route_ref = (uintptr_t)route_var.inner;
13739 if (route_var.is_owned) {
13742 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13743 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13744 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13745 CHECK(obj != NULL);
13746 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
13747 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13748 (*env)->ExceptionDescribe(env);
13749 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
13751 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13752 CHECK_ACCESS(ret_ptr);
13753 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
13755 if (get_jenv_res == JNI_EDETACHED) {
13756 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13760 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
13761 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13763 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13764 if (get_jenv_res == JNI_EDETACHED) {
13765 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13767 DO_ASSERT(get_jenv_res == JNI_OK);
13769 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13770 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13771 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13772 CHECK(obj != NULL);
13773 (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
13774 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13775 (*env)->ExceptionDescribe(env);
13776 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
13778 if (get_jenv_res == JNI_EDETACHED) {
13779 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13782 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
13783 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
13784 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13786 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
13787 jclass c = (*env)->GetObjectClass(env, o);
13789 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
13790 atomic_init(&calls->refcnt, 1);
13791 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13792 calls->o = (*env)->NewWeakGlobalRef(env, o);
13793 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
13794 CHECK(calls->node_id_meth != NULL);
13795 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
13796 CHECK(calls->first_hops_meth != NULL);
13797 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
13798 CHECK(calls->send_payment_meth != NULL);
13799 calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
13800 CHECK(calls->send_spontaneous_payment_meth != NULL);
13801 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
13802 CHECK(calls->retry_payment_meth != NULL);
13803 calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
13804 CHECK(calls->abandon_payment_meth != NULL);
13807 .this_arg = (void*) calls,
13808 .node_id = node_id_LDKPayer_jcall,
13809 .first_hops = first_hops_LDKPayer_jcall,
13810 .send_payment = send_payment_LDKPayer_jcall,
13811 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
13812 .retry_payment = retry_payment_LDKPayer_jcall,
13813 .abandon_payment = abandon_payment_LDKPayer_jcall,
13814 .free = LDKPayer_JCalls_free,
13818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
13819 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
13820 *res_ptr = LDKPayer_init(env, clz, o);
13821 return (uint64_t)res_ptr;
13823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13824 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13825 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13826 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13827 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13828 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
13832 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
13833 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13834 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13835 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13836 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
13837 int64_tArray ret_arr = NULL;
13838 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13839 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13840 for (size_t q = 0; q < ret_var.datalen; q++) {
13841 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
13842 int64_t ret_conv_16_ref = 0;
13843 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13844 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
13846 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
13847 if (ret_conv_16_var.is_owned) {
13848 ret_conv_16_ref |= 1;
13850 ret_arr_ptr[q] = ret_conv_16_ref;
13852 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13853 FREE(ret_var.data);
13857 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) {
13858 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13859 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13860 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13861 LDKRoute route_conv;
13862 route_conv.inner = (void*)(route & (~1));
13863 route_conv.is_owned = false;
13864 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13865 LDKThirtyTwoBytes payment_hash_ref;
13866 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13867 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13868 LDKThirtyTwoBytes payment_secret_ref;
13869 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
13870 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
13871 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13872 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
13873 return (int64_t)ret_conv;
13876 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) {
13877 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13878 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13879 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13880 LDKRoute route_conv;
13881 route_conv.inner = (void*)(route & (~1));
13882 route_conv.is_owned = false;
13883 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13884 LDKThirtyTwoBytes payment_preimage_ref;
13885 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13886 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13887 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13888 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
13889 return (int64_t)ret_conv;
13892 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) {
13893 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13894 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13895 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13896 LDKRoute route_conv;
13897 route_conv.inner = (void*)(route & (~1));
13898 route_conv.is_owned = false;
13899 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13900 LDKThirtyTwoBytes payment_id_ref;
13901 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13902 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13903 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13904 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
13905 return (int64_t)ret_conv;
13908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
13909 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13910 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13911 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13912 LDKThirtyTwoBytes payment_id_ref;
13913 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13914 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13915 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
13918 typedef struct LDKRouter_JCalls {
13919 atomic_size_t refcnt;
13922 jmethodID find_route_meth;
13923 } LDKRouter_JCalls;
13924 static void LDKRouter_JCalls_free(void* this_arg) {
13925 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13926 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13928 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13929 if (get_jenv_res == JNI_EDETACHED) {
13930 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13932 DO_ASSERT(get_jenv_res == JNI_OK);
13934 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13935 if (get_jenv_res == JNI_EDETACHED) {
13936 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13941 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) {
13942 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13944 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13945 if (get_jenv_res == JNI_EDETACHED) {
13946 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13948 DO_ASSERT(get_jenv_res == JNI_OK);
13950 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
13951 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
13952 LDKRouteParameters route_params_var = *route_params;
13953 int64_t route_params_ref = 0;
13954 route_params_var = RouteParameters_clone(&route_params_var);
13955 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13956 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13957 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
13958 route_params_ref = (uintptr_t)route_params_var.inner;
13959 if (route_params_var.is_owned) {
13960 route_params_ref |= 1;
13962 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13963 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
13964 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
13965 int64_tArray first_hops_arr = NULL;
13966 if (first_hops != NULL) {
13967 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
13968 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
13969 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
13970 for (size_t q = 0; q < first_hops_var.datalen; q++) {
13971 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
13972 int64_t first_hops_conv_16_ref = 0;
13973 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13974 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13975 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
13976 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
13977 if (first_hops_conv_16_var.is_owned) {
13978 first_hops_conv_16_ref |= 1;
13980 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
13982 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
13984 // WARNING: This object doesn't live past this scope, needs clone!
13985 int64_t ret_scorer = ((uintptr_t)scorer) | 1;
13986 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13987 CHECK(obj != NULL);
13988 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, payment_hash_arr, first_hops_arr, ret_scorer);
13989 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13990 (*env)->ExceptionDescribe(env);
13991 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
13993 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13994 CHECK_ACCESS(ret_ptr);
13995 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
13997 if (get_jenv_res == JNI_EDETACHED) {
13998 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
14002 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
14003 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
14004 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14006 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
14007 jclass c = (*env)->GetObjectClass(env, o);
14009 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
14010 atomic_init(&calls->refcnt, 1);
14011 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
14012 calls->o = (*env)->NewWeakGlobalRef(env, o);
14013 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
14014 CHECK(calls->find_route_meth != NULL);
14017 .this_arg = (void*) calls,
14018 .find_route = find_route_LDKRouter_jcall,
14019 .free = LDKRouter_JCalls_free,
14023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
14024 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
14025 *res_ptr = LDKRouter_init(env, clz, o);
14026 return (uint64_t)res_ptr;
14028 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 route_params, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) {
14029 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
14030 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
14031 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
14032 LDKPublicKey payer_ref;
14033 CHECK((*env)->GetArrayLength(env, payer) == 33);
14034 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
14035 LDKRouteParameters route_params_conv;
14036 route_params_conv.inner = (void*)(route_params & (~1));
14037 route_params_conv.is_owned = false;
14038 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
14039 unsigned char payment_hash_arr[32];
14040 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14041 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
14042 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
14043 LDKCVec_ChannelDetailsZ first_hops_constr;
14044 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
14045 if (first_hops != NULL) {
14046 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
14047 if (first_hops_constr.datalen > 0)
14048 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
14050 first_hops_constr.data = NULL;
14051 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
14052 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
14053 int64_t first_hops_conv_16 = first_hops_vals[q];
14054 LDKChannelDetails first_hops_conv_16_conv;
14055 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
14056 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
14057 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
14058 first_hops_constr.data[q] = first_hops_conv_16_conv;
14060 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
14061 first_hops_ptr = &first_hops_constr;
14063 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
14064 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
14065 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
14066 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
14067 *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, scorer_conv);
14068 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
14069 return (int64_t)ret_conv;
14072 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14073 LDKStr ret_str = _ldk_get_compiled_version();
14074 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14079 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
14080 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
14081 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
14086 static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
14087 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14088 *ret_copy = Bech32Error_clone(arg);
14089 int64_t ret_ref = (uintptr_t)ret_copy;
14092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14093 LDKBech32Error* arg_conv = (LDKBech32Error*)arg;
14094 int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
14098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14099 LDKBech32Error* orig_conv = (LDKBech32Error*)orig;
14100 LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14101 *ret_copy = Bech32Error_clone(orig_conv);
14102 int64_t ret_ref = (uintptr_t)ret_copy;
14106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
14107 if ((o & 1) != 0) return;
14108 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
14109 CHECK_ACCESS(o_ptr);
14110 LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
14112 Bech32Error_free(o_conv);
14115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
14116 LDKTransaction _res_ref;
14117 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
14118 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
14119 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
14120 _res_ref.data_is_owned = true;
14121 Transaction_free(_res_ref);
14124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
14125 LDKCVec_u8Z script_pubkey_ref;
14126 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
14127 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
14128 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
14129 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14130 *ret_ref = TxOut_new(script_pubkey_ref, value);
14131 return (int64_t)ret_ref;
14134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
14135 if ((_res & 1) != 0) return;
14136 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14137 CHECK_ACCESS(_res_ptr);
14138 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
14140 TxOut_free(_res_conv);
14143 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
14144 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14145 *ret_ref = TxOut_clone(arg);
14146 return (int64_t)ret_ref;
14148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14149 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
14150 int64_t ret_conv = TxOut_clone_ptr(arg_conv);
14154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14155 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
14156 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14157 *ret_ref = TxOut_clone(orig_conv);
14158 return (int64_t)ret_ref;
14161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
14162 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
14166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
14167 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14168 *ret_conv = CResult_NoneNoneZ_ok();
14169 return (int64_t)ret_conv;
14172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
14173 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14174 *ret_conv = CResult_NoneNoneZ_err();
14175 return (int64_t)ret_conv;
14178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14179 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
14180 jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
14184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14185 if ((_res & 1) != 0) return;
14186 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14187 CHECK_ACCESS(_res_ptr);
14188 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
14190 CResult_NoneNoneZ_free(_res_conv);
14193 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
14194 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14195 *ret_conv = CResult_NoneNoneZ_clone(arg);
14196 return (int64_t)ret_conv;
14198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14199 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
14200 int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
14204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14205 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
14206 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14207 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
14208 return (int64_t)ret_conv;
14211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14212 LDKCounterpartyCommitmentSecrets o_conv;
14213 o_conv.inner = (void*)(o & (~1));
14214 o_conv.is_owned = (o & 1) || (o == 0);
14215 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14216 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
14217 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14218 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
14219 return (int64_t)ret_conv;
14222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14223 LDKDecodeError e_conv;
14224 e_conv.inner = (void*)(e & (~1));
14225 e_conv.is_owned = (e & 1) || (e == 0);
14226 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14227 e_conv = DecodeError_clone(&e_conv);
14228 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14229 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
14230 return (int64_t)ret_conv;
14233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14234 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
14235 jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
14239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14240 if ((_res & 1) != 0) return;
14241 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14242 CHECK_ACCESS(_res_ptr);
14243 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
14245 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
14248 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
14249 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14250 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
14251 return (int64_t)ret_conv;
14253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14254 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
14255 int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
14259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14260 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
14261 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14262 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
14263 return (int64_t)ret_conv;
14266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14267 LDKSecretKey o_ref;
14268 CHECK((*env)->GetArrayLength(env, o) == 32);
14269 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
14270 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14271 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
14272 return (int64_t)ret_conv;
14275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14276 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14277 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14278 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
14279 return (int64_t)ret_conv;
14282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14283 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
14284 jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
14288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14289 if ((_res & 1) != 0) return;
14290 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14291 CHECK_ACCESS(_res_ptr);
14292 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
14294 CResult_SecretKeyErrorZ_free(_res_conv);
14297 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
14298 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14299 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
14300 return (int64_t)ret_conv;
14302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14303 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
14304 int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
14308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14309 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
14310 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
14311 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
14312 return (int64_t)ret_conv;
14315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
14316 LDKPublicKey o_ref;
14317 CHECK((*env)->GetArrayLength(env, o) == 33);
14318 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
14319 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14320 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
14321 return (int64_t)ret_conv;
14324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14325 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14326 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14327 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
14328 return (int64_t)ret_conv;
14331 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14332 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
14333 jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
14337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14338 if ((_res & 1) != 0) return;
14339 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14340 CHECK_ACCESS(_res_ptr);
14341 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
14343 CResult_PublicKeyErrorZ_free(_res_conv);
14346 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
14347 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14348 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
14349 return (int64_t)ret_conv;
14351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14352 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
14353 int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
14357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14358 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
14359 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14360 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
14361 return (int64_t)ret_conv;
14364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14365 LDKTxCreationKeys o_conv;
14366 o_conv.inner = (void*)(o & (~1));
14367 o_conv.is_owned = (o & 1) || (o == 0);
14368 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14369 o_conv = TxCreationKeys_clone(&o_conv);
14370 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14371 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
14372 return (int64_t)ret_conv;
14375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14376 LDKDecodeError e_conv;
14377 e_conv.inner = (void*)(e & (~1));
14378 e_conv.is_owned = (e & 1) || (e == 0);
14379 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14380 e_conv = DecodeError_clone(&e_conv);
14381 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14382 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
14383 return (int64_t)ret_conv;
14386 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14387 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
14388 jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
14392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14393 if ((_res & 1) != 0) return;
14394 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14395 CHECK_ACCESS(_res_ptr);
14396 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
14398 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
14401 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
14402 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14403 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
14404 return (int64_t)ret_conv;
14406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14407 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
14408 int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
14412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14413 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
14414 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14415 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
14416 return (int64_t)ret_conv;
14419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14420 LDKChannelPublicKeys o_conv;
14421 o_conv.inner = (void*)(o & (~1));
14422 o_conv.is_owned = (o & 1) || (o == 0);
14423 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14424 o_conv = ChannelPublicKeys_clone(&o_conv);
14425 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14426 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
14427 return (int64_t)ret_conv;
14430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14431 LDKDecodeError e_conv;
14432 e_conv.inner = (void*)(e & (~1));
14433 e_conv.is_owned = (e & 1) || (e == 0);
14434 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14435 e_conv = DecodeError_clone(&e_conv);
14436 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14437 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
14438 return (int64_t)ret_conv;
14441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14442 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
14443 jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
14447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14448 if ((_res & 1) != 0) return;
14449 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14450 CHECK_ACCESS(_res_ptr);
14451 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
14453 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
14456 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
14457 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14458 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
14459 return (int64_t)ret_conv;
14461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14462 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
14463 int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
14467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14468 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
14469 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14470 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
14471 return (int64_t)ret_conv;
14474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14475 LDKTxCreationKeys o_conv;
14476 o_conv.inner = (void*)(o & (~1));
14477 o_conv.is_owned = (o & 1) || (o == 0);
14478 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14479 o_conv = TxCreationKeys_clone(&o_conv);
14480 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14481 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
14482 return (int64_t)ret_conv;
14485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14486 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14487 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14488 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
14489 return (int64_t)ret_conv;
14492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14493 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
14494 jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
14498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14499 if ((_res & 1) != 0) return;
14500 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14501 CHECK_ACCESS(_res_ptr);
14502 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
14504 CResult_TxCreationKeysErrorZ_free(_res_conv);
14507 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
14508 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14509 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
14510 return (int64_t)ret_conv;
14512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14513 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
14514 int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
14518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14519 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
14520 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14521 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
14522 return (int64_t)ret_conv;
14525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
14526 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14527 *ret_copy = COption_u32Z_some(o);
14528 int64_t ret_ref = (uintptr_t)ret_copy;
14532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
14533 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14534 *ret_copy = COption_u32Z_none();
14535 int64_t ret_ref = (uintptr_t)ret_copy;
14539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14540 if ((_res & 1) != 0) return;
14541 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14542 CHECK_ACCESS(_res_ptr);
14543 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
14545 COption_u32Z_free(_res_conv);
14548 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
14549 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14550 *ret_copy = COption_u32Z_clone(arg);
14551 int64_t ret_ref = (uintptr_t)ret_copy;
14554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14555 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
14556 int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
14560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14561 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
14562 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14563 *ret_copy = COption_u32Z_clone(orig_conv);
14564 int64_t ret_ref = (uintptr_t)ret_copy;
14568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14569 LDKHTLCOutputInCommitment o_conv;
14570 o_conv.inner = (void*)(o & (~1));
14571 o_conv.is_owned = (o & 1) || (o == 0);
14572 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14573 o_conv = HTLCOutputInCommitment_clone(&o_conv);
14574 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14575 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
14576 return (int64_t)ret_conv;
14579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14580 LDKDecodeError e_conv;
14581 e_conv.inner = (void*)(e & (~1));
14582 e_conv.is_owned = (e & 1) || (e == 0);
14583 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14584 e_conv = DecodeError_clone(&e_conv);
14585 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14586 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
14587 return (int64_t)ret_conv;
14590 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14591 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
14592 jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
14596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14597 if ((_res & 1) != 0) return;
14598 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14599 CHECK_ACCESS(_res_ptr);
14600 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
14602 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
14605 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
14606 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14607 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
14608 return (int64_t)ret_conv;
14610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14611 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
14612 int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
14616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14617 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
14618 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14619 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
14620 return (int64_t)ret_conv;
14623 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
14624 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
14628 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
14629 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
14633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
14634 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
14635 COption_NoneZ_free(_res_conv);
14638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14639 LDKCounterpartyChannelTransactionParameters o_conv;
14640 o_conv.inner = (void*)(o & (~1));
14641 o_conv.is_owned = (o & 1) || (o == 0);
14642 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14643 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
14644 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14645 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14646 return (int64_t)ret_conv;
14649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14650 LDKDecodeError e_conv;
14651 e_conv.inner = (void*)(e & (~1));
14652 e_conv.is_owned = (e & 1) || (e == 0);
14653 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14654 e_conv = DecodeError_clone(&e_conv);
14655 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14656 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
14657 return (int64_t)ret_conv;
14660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14661 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
14662 jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14667 if ((_res & 1) != 0) return;
14668 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14669 CHECK_ACCESS(_res_ptr);
14670 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14672 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14675 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14676 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14677 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
14678 return (int64_t)ret_conv;
14680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14681 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
14682 int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14687 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
14688 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14689 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14690 return (int64_t)ret_conv;
14693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14694 LDKChannelTransactionParameters o_conv;
14695 o_conv.inner = (void*)(o & (~1));
14696 o_conv.is_owned = (o & 1) || (o == 0);
14697 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14698 o_conv = ChannelTransactionParameters_clone(&o_conv);
14699 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14700 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14701 return (int64_t)ret_conv;
14704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14705 LDKDecodeError e_conv;
14706 e_conv.inner = (void*)(e & (~1));
14707 e_conv.is_owned = (e & 1) || (e == 0);
14708 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14709 e_conv = DecodeError_clone(&e_conv);
14710 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14711 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
14712 return (int64_t)ret_conv;
14715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14716 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
14717 jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14722 if ((_res & 1) != 0) return;
14723 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14724 CHECK_ACCESS(_res_ptr);
14725 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14727 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14730 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14731 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14732 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
14733 return (int64_t)ret_conv;
14735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14736 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
14737 int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14742 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
14743 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14744 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14745 return (int64_t)ret_conv;
14748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14749 LDKCVec_SignatureZ _res_constr;
14750 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14751 if (_res_constr.datalen > 0)
14752 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14754 _res_constr.data = NULL;
14755 for (size_t i = 0; i < _res_constr.datalen; i++) {
14756 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
14757 LDKSignature _res_conv_8_ref;
14758 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
14759 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
14760 _res_constr.data[i] = _res_conv_8_ref;
14762 CVec_SignatureZ_free(_res_constr);
14765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14766 LDKHolderCommitmentTransaction o_conv;
14767 o_conv.inner = (void*)(o & (~1));
14768 o_conv.is_owned = (o & 1) || (o == 0);
14769 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14770 o_conv = HolderCommitmentTransaction_clone(&o_conv);
14771 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14772 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
14773 return (int64_t)ret_conv;
14776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14777 LDKDecodeError e_conv;
14778 e_conv.inner = (void*)(e & (~1));
14779 e_conv.is_owned = (e & 1) || (e == 0);
14780 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14781 e_conv = DecodeError_clone(&e_conv);
14782 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14783 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
14784 return (int64_t)ret_conv;
14787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14788 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
14789 jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14794 if ((_res & 1) != 0) return;
14795 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14796 CHECK_ACCESS(_res_ptr);
14797 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14799 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
14802 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14803 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14804 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
14805 return (int64_t)ret_conv;
14807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14808 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
14809 int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14814 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
14815 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14816 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14817 return (int64_t)ret_conv;
14820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14821 LDKBuiltCommitmentTransaction o_conv;
14822 o_conv.inner = (void*)(o & (~1));
14823 o_conv.is_owned = (o & 1) || (o == 0);
14824 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14825 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
14826 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14827 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
14828 return (int64_t)ret_conv;
14831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14832 LDKDecodeError e_conv;
14833 e_conv.inner = (void*)(e & (~1));
14834 e_conv.is_owned = (e & 1) || (e == 0);
14835 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14836 e_conv = DecodeError_clone(&e_conv);
14837 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14838 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
14839 return (int64_t)ret_conv;
14842 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14843 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
14844 jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14849 if ((_res & 1) != 0) return;
14850 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14851 CHECK_ACCESS(_res_ptr);
14852 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14854 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
14857 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14858 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14859 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
14860 return (int64_t)ret_conv;
14862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14863 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
14864 int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14869 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
14870 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14871 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14872 return (int64_t)ret_conv;
14875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14876 LDKTrustedClosingTransaction o_conv;
14877 o_conv.inner = (void*)(o & (~1));
14878 o_conv.is_owned = (o & 1) || (o == 0);
14879 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14880 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
14881 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14882 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
14883 return (int64_t)ret_conv;
14886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14887 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14888 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
14889 return (int64_t)ret_conv;
14892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14893 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
14894 jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
14898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14899 if ((_res & 1) != 0) return;
14900 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14901 CHECK_ACCESS(_res_ptr);
14902 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
14904 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
14907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14908 LDKCommitmentTransaction o_conv;
14909 o_conv.inner = (void*)(o & (~1));
14910 o_conv.is_owned = (o & 1) || (o == 0);
14911 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14912 o_conv = CommitmentTransaction_clone(&o_conv);
14913 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14914 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
14915 return (int64_t)ret_conv;
14918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14919 LDKDecodeError e_conv;
14920 e_conv.inner = (void*)(e & (~1));
14921 e_conv.is_owned = (e & 1) || (e == 0);
14922 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14923 e_conv = DecodeError_clone(&e_conv);
14924 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14925 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
14926 return (int64_t)ret_conv;
14929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14930 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
14931 jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14936 if ((_res & 1) != 0) return;
14937 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14938 CHECK_ACCESS(_res_ptr);
14939 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
14941 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
14944 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14945 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14946 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
14947 return (int64_t)ret_conv;
14949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14950 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
14951 int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14956 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
14957 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14958 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
14959 return (int64_t)ret_conv;
14962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14963 LDKTrustedCommitmentTransaction o_conv;
14964 o_conv.inner = (void*)(o & (~1));
14965 o_conv.is_owned = (o & 1) || (o == 0);
14966 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14967 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
14968 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14969 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
14970 return (int64_t)ret_conv;
14973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14974 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14975 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
14976 return (int64_t)ret_conv;
14979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14980 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
14981 jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
14985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14986 if ((_res & 1) != 0) return;
14987 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14988 CHECK_ACCESS(_res_ptr);
14989 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
14991 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
14994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
14995 LDKCVec_SignatureZ o_constr;
14996 o_constr.datalen = (*env)->GetArrayLength(env, o);
14997 if (o_constr.datalen > 0)
14998 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15000 o_constr.data = NULL;
15001 for (size_t i = 0; i < o_constr.datalen; i++) {
15002 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
15003 LDKSignature o_conv_8_ref;
15004 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
15005 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
15006 o_constr.data[i] = o_conv_8_ref;
15008 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15009 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
15010 return (int64_t)ret_conv;
15013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
15014 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15015 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
15016 return (int64_t)ret_conv;
15019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15020 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
15021 jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
15025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15026 if ((_res & 1) != 0) return;
15027 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15028 CHECK_ACCESS(_res_ptr);
15029 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
15031 CResult_CVec_SignatureZNoneZ_free(_res_conv);
15034 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
15035 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15036 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
15037 return (int64_t)ret_conv;
15039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15040 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
15041 int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
15045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15046 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
15047 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15048 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
15049 return (int64_t)ret_conv;
15052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15053 LDKShutdownScript o_conv;
15054 o_conv.inner = (void*)(o & (~1));
15055 o_conv.is_owned = (o & 1) || (o == 0);
15056 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15057 o_conv = ShutdownScript_clone(&o_conv);
15058 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15059 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
15060 return (int64_t)ret_conv;
15063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15064 LDKDecodeError e_conv;
15065 e_conv.inner = (void*)(e & (~1));
15066 e_conv.is_owned = (e & 1) || (e == 0);
15067 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15068 e_conv = DecodeError_clone(&e_conv);
15069 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15070 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
15071 return (int64_t)ret_conv;
15074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15075 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
15076 jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
15080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15081 if ((_res & 1) != 0) return;
15082 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15083 CHECK_ACCESS(_res_ptr);
15084 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
15086 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
15089 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
15090 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15091 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
15092 return (int64_t)ret_conv;
15094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15095 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
15096 int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
15100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15101 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
15102 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15103 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
15104 return (int64_t)ret_conv;
15107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15108 LDKShutdownScript o_conv;
15109 o_conv.inner = (void*)(o & (~1));
15110 o_conv.is_owned = (o & 1) || (o == 0);
15111 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15112 o_conv = ShutdownScript_clone(&o_conv);
15113 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15114 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
15115 return (int64_t)ret_conv;
15118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15119 LDKInvalidShutdownScript e_conv;
15120 e_conv.inner = (void*)(e & (~1));
15121 e_conv.is_owned = (e & 1) || (e == 0);
15122 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15123 e_conv = InvalidShutdownScript_clone(&e_conv);
15124 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15125 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
15126 return (int64_t)ret_conv;
15129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15130 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
15131 jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
15135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15136 if ((_res & 1) != 0) return;
15137 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15138 CHECK_ACCESS(_res_ptr);
15139 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
15141 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
15144 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
15145 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15146 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
15147 return (int64_t)ret_conv;
15149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15150 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
15151 int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
15155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15156 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
15157 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15158 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
15159 return (int64_t)ret_conv;
15162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
15163 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15164 *ret_conv = CResult_NoneErrorZ_ok();
15165 return (int64_t)ret_conv;
15168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15169 LDKIOError e_conv = LDKIOError_from_java(env, e);
15170 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15171 *ret_conv = CResult_NoneErrorZ_err(e_conv);
15172 return (int64_t)ret_conv;
15175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15176 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
15177 jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
15181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15182 if ((_res & 1) != 0) return;
15183 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15184 CHECK_ACCESS(_res_ptr);
15185 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
15187 CResult_NoneErrorZ_free(_res_conv);
15190 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
15191 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15192 *ret_conv = CResult_NoneErrorZ_clone(arg);
15193 return (int64_t)ret_conv;
15195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15196 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
15197 int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
15201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15202 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
15203 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
15204 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
15205 return (int64_t)ret_conv;
15208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15209 LDKRouteHop o_conv;
15210 o_conv.inner = (void*)(o & (~1));
15211 o_conv.is_owned = (o & 1) || (o == 0);
15212 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15213 o_conv = RouteHop_clone(&o_conv);
15214 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15215 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
15216 return (int64_t)ret_conv;
15219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15220 LDKDecodeError e_conv;
15221 e_conv.inner = (void*)(e & (~1));
15222 e_conv.is_owned = (e & 1) || (e == 0);
15223 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15224 e_conv = DecodeError_clone(&e_conv);
15225 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15226 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
15227 return (int64_t)ret_conv;
15230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15231 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
15232 jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
15236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15237 if ((_res & 1) != 0) return;
15238 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15239 CHECK_ACCESS(_res_ptr);
15240 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
15242 CResult_RouteHopDecodeErrorZ_free(_res_conv);
15245 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
15246 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15247 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
15248 return (int64_t)ret_conv;
15250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15251 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
15252 int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
15256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15257 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
15258 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
15259 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
15260 return (int64_t)ret_conv;
15263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15264 LDKCVec_RouteHopZ _res_constr;
15265 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15266 if (_res_constr.datalen > 0)
15267 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15269 _res_constr.data = NULL;
15270 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15271 for (size_t k = 0; k < _res_constr.datalen; k++) {
15272 int64_t _res_conv_10 = _res_vals[k];
15273 LDKRouteHop _res_conv_10_conv;
15274 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
15275 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
15276 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
15277 _res_constr.data[k] = _res_conv_10_conv;
15279 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15280 CVec_RouteHopZ_free(_res_constr);
15283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15284 LDKCVec_CVec_RouteHopZZ _res_constr;
15285 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15286 if (_res_constr.datalen > 0)
15287 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15289 _res_constr.data = NULL;
15290 for (size_t m = 0; m < _res_constr.datalen; m++) {
15291 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
15292 LDKCVec_RouteHopZ _res_conv_12_constr;
15293 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
15294 if (_res_conv_12_constr.datalen > 0)
15295 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15297 _res_conv_12_constr.data = NULL;
15298 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
15299 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
15300 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
15301 LDKRouteHop _res_conv_12_conv_10_conv;
15302 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
15303 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
15304 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
15305 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
15307 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
15308 _res_constr.data[m] = _res_conv_12_constr;
15310 CVec_CVec_RouteHopZZ_free(_res_constr);
15313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15315 o_conv.inner = (void*)(o & (~1));
15316 o_conv.is_owned = (o & 1) || (o == 0);
15317 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15318 o_conv = Route_clone(&o_conv);
15319 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15320 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
15321 return (int64_t)ret_conv;
15324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15325 LDKDecodeError e_conv;
15326 e_conv.inner = (void*)(e & (~1));
15327 e_conv.is_owned = (e & 1) || (e == 0);
15328 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15329 e_conv = DecodeError_clone(&e_conv);
15330 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15331 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
15332 return (int64_t)ret_conv;
15335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15336 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
15337 jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
15341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15342 if ((_res & 1) != 0) return;
15343 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15344 CHECK_ACCESS(_res_ptr);
15345 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
15347 CResult_RouteDecodeErrorZ_free(_res_conv);
15350 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
15351 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15352 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
15353 return (int64_t)ret_conv;
15355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15356 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
15357 int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
15361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15362 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
15363 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15364 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
15365 return (int64_t)ret_conv;
15368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15369 LDKRouteParameters o_conv;
15370 o_conv.inner = (void*)(o & (~1));
15371 o_conv.is_owned = (o & 1) || (o == 0);
15372 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15373 o_conv = RouteParameters_clone(&o_conv);
15374 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15375 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
15376 return (int64_t)ret_conv;
15379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15380 LDKDecodeError e_conv;
15381 e_conv.inner = (void*)(e & (~1));
15382 e_conv.is_owned = (e & 1) || (e == 0);
15383 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15384 e_conv = DecodeError_clone(&e_conv);
15385 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15386 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
15387 return (int64_t)ret_conv;
15390 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15391 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
15392 jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
15396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15397 if ((_res & 1) != 0) return;
15398 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15399 CHECK_ACCESS(_res_ptr);
15400 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
15402 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
15405 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
15406 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15407 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
15408 return (int64_t)ret_conv;
15410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15411 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
15412 int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
15416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15417 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
15418 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
15419 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
15420 return (int64_t)ret_conv;
15423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15424 LDKCVec_RouteHintZ _res_constr;
15425 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15426 if (_res_constr.datalen > 0)
15427 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
15429 _res_constr.data = NULL;
15430 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15431 for (size_t l = 0; l < _res_constr.datalen; l++) {
15432 int64_t _res_conv_11 = _res_vals[l];
15433 LDKRouteHint _res_conv_11_conv;
15434 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
15435 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
15436 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
15437 _res_constr.data[l] = _res_conv_11_conv;
15439 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15440 CVec_RouteHintZ_free(_res_constr);
15443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
15444 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15445 *ret_copy = COption_u64Z_some(o);
15446 int64_t ret_ref = (uintptr_t)ret_copy;
15450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
15451 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15452 *ret_copy = COption_u64Z_none();
15453 int64_t ret_ref = (uintptr_t)ret_copy;
15457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
15458 if ((_res & 1) != 0) return;
15459 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15460 CHECK_ACCESS(_res_ptr);
15461 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15463 COption_u64Z_free(_res_conv);
15466 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15467 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15468 *ret_copy = COption_u64Z_clone(arg);
15469 int64_t ret_ref = (uintptr_t)ret_copy;
15472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15473 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
15474 int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
15478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15479 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
15480 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15481 *ret_copy = COption_u64Z_clone(orig_conv);
15482 int64_t ret_ref = (uintptr_t)ret_copy;
15486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15487 LDKPaymentParameters o_conv;
15488 o_conv.inner = (void*)(o & (~1));
15489 o_conv.is_owned = (o & 1) || (o == 0);
15490 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15491 o_conv = PaymentParameters_clone(&o_conv);
15492 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15493 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
15494 return (int64_t)ret_conv;
15497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15498 LDKDecodeError e_conv;
15499 e_conv.inner = (void*)(e & (~1));
15500 e_conv.is_owned = (e & 1) || (e == 0);
15501 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15502 e_conv = DecodeError_clone(&e_conv);
15503 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15504 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
15505 return (int64_t)ret_conv;
15508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15509 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
15510 jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
15514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15515 if ((_res & 1) != 0) return;
15516 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15517 CHECK_ACCESS(_res_ptr);
15518 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
15520 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
15523 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
15524 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15525 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
15526 return (int64_t)ret_conv;
15528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15529 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
15530 int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
15534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15535 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
15536 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15537 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
15538 return (int64_t)ret_conv;
15541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15542 LDKCVec_RouteHintHopZ _res_constr;
15543 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15544 if (_res_constr.datalen > 0)
15545 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
15547 _res_constr.data = NULL;
15548 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15549 for (size_t o = 0; o < _res_constr.datalen; o++) {
15550 int64_t _res_conv_14 = _res_vals[o];
15551 LDKRouteHintHop _res_conv_14_conv;
15552 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
15553 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
15554 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15555 _res_constr.data[o] = _res_conv_14_conv;
15557 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15558 CVec_RouteHintHopZ_free(_res_constr);
15561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15562 LDKRouteHint o_conv;
15563 o_conv.inner = (void*)(o & (~1));
15564 o_conv.is_owned = (o & 1) || (o == 0);
15565 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15566 o_conv = RouteHint_clone(&o_conv);
15567 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15568 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
15569 return (int64_t)ret_conv;
15572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15573 LDKDecodeError e_conv;
15574 e_conv.inner = (void*)(e & (~1));
15575 e_conv.is_owned = (e & 1) || (e == 0);
15576 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15577 e_conv = DecodeError_clone(&e_conv);
15578 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15579 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
15580 return (int64_t)ret_conv;
15583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15584 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
15585 jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
15589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15590 if ((_res & 1) != 0) return;
15591 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15592 CHECK_ACCESS(_res_ptr);
15593 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
15595 CResult_RouteHintDecodeErrorZ_free(_res_conv);
15598 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
15599 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15600 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
15601 return (int64_t)ret_conv;
15603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15604 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
15605 int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
15609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15610 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
15611 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15612 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
15613 return (int64_t)ret_conv;
15616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15617 LDKRouteHintHop o_conv;
15618 o_conv.inner = (void*)(o & (~1));
15619 o_conv.is_owned = (o & 1) || (o == 0);
15620 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15621 o_conv = RouteHintHop_clone(&o_conv);
15622 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15623 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
15624 return (int64_t)ret_conv;
15627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15628 LDKDecodeError e_conv;
15629 e_conv.inner = (void*)(e & (~1));
15630 e_conv.is_owned = (e & 1) || (e == 0);
15631 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15632 e_conv = DecodeError_clone(&e_conv);
15633 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15634 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
15635 return (int64_t)ret_conv;
15638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15639 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
15640 jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
15644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15645 if ((_res & 1) != 0) return;
15646 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15647 CHECK_ACCESS(_res_ptr);
15648 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
15650 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
15653 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
15654 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15655 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
15656 return (int64_t)ret_conv;
15658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15659 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
15660 int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
15664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15665 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
15666 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15667 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
15668 return (int64_t)ret_conv;
15671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15672 LDKCVec_ChannelDetailsZ _res_constr;
15673 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15674 if (_res_constr.datalen > 0)
15675 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
15677 _res_constr.data = NULL;
15678 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15679 for (size_t q = 0; q < _res_constr.datalen; q++) {
15680 int64_t _res_conv_16 = _res_vals[q];
15681 LDKChannelDetails _res_conv_16_conv;
15682 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
15683 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
15684 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15685 _res_constr.data[q] = _res_conv_16_conv;
15687 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15688 CVec_ChannelDetailsZ_free(_res_constr);
15691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15693 o_conv.inner = (void*)(o & (~1));
15694 o_conv.is_owned = (o & 1) || (o == 0);
15695 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15696 o_conv = Route_clone(&o_conv);
15697 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15698 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
15699 return (int64_t)ret_conv;
15702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15703 LDKLightningError e_conv;
15704 e_conv.inner = (void*)(e & (~1));
15705 e_conv.is_owned = (e & 1) || (e == 0);
15706 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15707 e_conv = LightningError_clone(&e_conv);
15708 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15709 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
15710 return (int64_t)ret_conv;
15713 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15714 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
15715 jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
15719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15720 if ((_res & 1) != 0) return;
15721 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15722 CHECK_ACCESS(_res_ptr);
15723 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
15725 CResult_RouteLightningErrorZ_free(_res_conv);
15728 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
15729 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15730 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
15731 return (int64_t)ret_conv;
15733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15734 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
15735 int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
15739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15740 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
15741 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15742 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
15743 return (int64_t)ret_conv;
15746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15747 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15748 CHECK_ACCESS(o_ptr);
15749 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
15750 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
15751 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15752 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
15753 return (int64_t)ret_conv;
15756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15757 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
15758 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15759 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
15760 return (int64_t)ret_conv;
15763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15764 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
15765 jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
15769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15770 if ((_res & 1) != 0) return;
15771 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15772 CHECK_ACCESS(_res_ptr);
15773 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
15775 CResult_TxOutAccessErrorZ_free(_res_conv);
15778 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
15779 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15780 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
15781 return (int64_t)ret_conv;
15783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15784 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
15785 int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
15789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15790 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
15791 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15792 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
15793 return (int64_t)ret_conv;
15796 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
15797 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15798 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
15799 return ((int64_t)ret_conv);
15801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15802 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
15803 int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
15807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15808 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
15809 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15810 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
15811 return ((int64_t)ret_conv);
15814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
15815 LDKTransaction b_ref;
15816 b_ref.datalen = (*env)->GetArrayLength(env, b);
15817 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
15818 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
15819 b_ref.data_is_owned = true;
15820 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15821 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
15822 return ((int64_t)ret_conv);
15825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15826 if ((_res & 1) != 0) return;
15827 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15828 CHECK_ACCESS(_res_ptr);
15829 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
15831 C2Tuple_usizeTransactionZ_free(_res_conv);
15834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15835 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
15836 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15837 if (_res_constr.datalen > 0)
15838 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15840 _res_constr.data = NULL;
15841 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15842 for (size_t c = 0; c < _res_constr.datalen; c++) {
15843 int64_t _res_conv_28 = _res_vals[c];
15844 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
15845 CHECK_ACCESS(_res_conv_28_ptr);
15846 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
15847 FREE((void*)_res_conv_28);
15848 _res_constr.data[c] = _res_conv_28_conv;
15850 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15851 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
15854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15855 LDKCVec_TxidZ _res_constr;
15856 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15857 if (_res_constr.datalen > 0)
15858 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
15860 _res_constr.data = NULL;
15861 for (size_t i = 0; i < _res_constr.datalen; i++) {
15862 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15863 LDKThirtyTwoBytes _res_conv_8_ref;
15864 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
15865 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
15866 _res_constr.data[i] = _res_conv_8_ref;
15868 CVec_TxidZ_free(_res_constr);
15871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
15872 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15873 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
15874 return (int64_t)ret_conv;
15877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
15878 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
15879 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15880 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
15881 return (int64_t)ret_conv;
15884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15885 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
15886 jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
15890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15891 if ((_res & 1) != 0) return;
15892 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15893 CHECK_ACCESS(_res_ptr);
15894 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
15896 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
15899 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
15900 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15901 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
15902 return (int64_t)ret_conv;
15904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15905 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
15906 int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
15910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15911 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
15912 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15913 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
15914 return (int64_t)ret_conv;
15917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15918 LDKCVec_MonitorEventZ _res_constr;
15919 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15920 if (_res_constr.datalen > 0)
15921 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
15923 _res_constr.data = NULL;
15924 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15925 for (size_t o = 0; o < _res_constr.datalen; o++) {
15926 int64_t _res_conv_14 = _res_vals[o];
15927 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
15928 CHECK_ACCESS(_res_conv_14_ptr);
15929 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
15930 FREE((void*)_res_conv_14);
15931 _res_constr.data[o] = _res_conv_14_conv;
15933 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15934 CVec_MonitorEventZ_free(_res_constr);
15937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15938 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15939 CHECK_ACCESS(o_ptr);
15940 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
15941 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
15942 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15943 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
15944 int64_t ret_ref = (uintptr_t)ret_copy;
15948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
15949 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15950 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
15951 int64_t ret_ref = (uintptr_t)ret_copy;
15955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15956 if ((_res & 1) != 0) return;
15957 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15958 CHECK_ACCESS(_res_ptr);
15959 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
15961 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
15964 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
15965 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15966 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
15967 int64_t ret_ref = (uintptr_t)ret_copy;
15970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15971 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
15972 int64_t ret_conv = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
15976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15977 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
15978 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15979 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
15980 int64_t ret_ref = (uintptr_t)ret_copy;
15984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15985 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15986 CHECK_ACCESS(o_ptr);
15987 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
15988 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
15989 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15990 *ret_copy = COption_ClosureReasonZ_some(o_conv);
15991 int64_t ret_ref = (uintptr_t)ret_copy;
15995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
15996 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15997 *ret_copy = COption_ClosureReasonZ_none();
15998 int64_t ret_ref = (uintptr_t)ret_copy;
16002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16003 if ((_res & 1) != 0) return;
16004 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16005 CHECK_ACCESS(_res_ptr);
16006 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
16008 COption_ClosureReasonZ_free(_res_conv);
16011 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
16012 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16013 *ret_copy = COption_ClosureReasonZ_clone(arg);
16014 int64_t ret_ref = (uintptr_t)ret_copy;
16017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16018 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
16019 int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
16023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16024 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
16025 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
16026 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
16027 int64_t ret_ref = (uintptr_t)ret_copy;
16031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16032 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16033 CHECK_ACCESS(o_ptr);
16034 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
16035 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
16036 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16037 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
16038 return (int64_t)ret_conv;
16041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16042 LDKDecodeError e_conv;
16043 e_conv.inner = (void*)(e & (~1));
16044 e_conv.is_owned = (e & 1) || (e == 0);
16045 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16046 e_conv = DecodeError_clone(&e_conv);
16047 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16048 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
16049 return (int64_t)ret_conv;
16052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16053 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
16054 jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
16058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16059 if ((_res & 1) != 0) return;
16060 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16061 CHECK_ACCESS(_res_ptr);
16062 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
16064 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
16067 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
16068 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16069 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
16070 return (int64_t)ret_conv;
16072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16073 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
16074 int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
16078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16079 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
16080 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
16081 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
16082 return (int64_t)ret_conv;
16085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16086 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16087 CHECK_ACCESS(o_ptr);
16088 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
16089 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
16090 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16091 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
16092 int64_t ret_ref = (uintptr_t)ret_copy;
16096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
16097 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16098 *ret_copy = COption_NetworkUpdateZ_none();
16099 int64_t ret_ref = (uintptr_t)ret_copy;
16103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16104 if ((_res & 1) != 0) return;
16105 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16106 CHECK_ACCESS(_res_ptr);
16107 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
16109 COption_NetworkUpdateZ_free(_res_conv);
16112 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
16113 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16114 *ret_copy = COption_NetworkUpdateZ_clone(arg);
16115 int64_t ret_ref = (uintptr_t)ret_copy;
16118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16119 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
16120 int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
16124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16125 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
16126 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
16127 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
16128 int64_t ret_ref = (uintptr_t)ret_copy;
16132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16133 LDKCVec_SpendableOutputDescriptorZ _res_constr;
16134 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16135 if (_res_constr.datalen > 0)
16136 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16138 _res_constr.data = NULL;
16139 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16140 for (size_t b = 0; b < _res_constr.datalen; b++) {
16141 int64_t _res_conv_27 = _res_vals[b];
16142 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
16143 CHECK_ACCESS(_res_conv_27_ptr);
16144 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
16145 FREE((void*)_res_conv_27);
16146 _res_constr.data[b] = _res_conv_27_conv;
16148 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16149 CVec_SpendableOutputDescriptorZ_free(_res_constr);
16152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
16153 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16154 CHECK_ACCESS(o_ptr);
16155 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
16156 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
16157 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16158 *ret_copy = COption_EventZ_some(o_conv);
16159 int64_t ret_ref = (uintptr_t)ret_copy;
16163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
16164 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16165 *ret_copy = COption_EventZ_none();
16166 int64_t ret_ref = (uintptr_t)ret_copy;
16170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16171 if ((_res & 1) != 0) return;
16172 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16173 CHECK_ACCESS(_res_ptr);
16174 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
16176 COption_EventZ_free(_res_conv);
16179 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
16180 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16181 *ret_copy = COption_EventZ_clone(arg);
16182 int64_t ret_ref = (uintptr_t)ret_copy;
16185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16186 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
16187 int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
16191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16192 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
16193 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
16194 *ret_copy = COption_EventZ_clone(orig_conv);
16195 int64_t ret_ref = (uintptr_t)ret_copy;
16199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16200 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16201 CHECK_ACCESS(o_ptr);
16202 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
16203 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
16204 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16205 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
16206 return (int64_t)ret_conv;
16209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16210 LDKDecodeError e_conv;
16211 e_conv.inner = (void*)(e & (~1));
16212 e_conv.is_owned = (e & 1) || (e == 0);
16213 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16214 e_conv = DecodeError_clone(&e_conv);
16215 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16216 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
16217 return (int64_t)ret_conv;
16220 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16221 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
16222 jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
16226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16227 if ((_res & 1) != 0) return;
16228 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16229 CHECK_ACCESS(_res_ptr);
16230 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
16232 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
16235 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
16236 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16237 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
16238 return (int64_t)ret_conv;
16240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16241 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
16242 int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
16246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16247 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
16248 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
16249 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
16250 return (int64_t)ret_conv;
16253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
16254 LDKCVec_MessageSendEventZ _res_constr;
16255 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16256 if (_res_constr.datalen > 0)
16257 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
16259 _res_constr.data = NULL;
16260 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
16261 for (size_t s = 0; s < _res_constr.datalen; s++) {
16262 int64_t _res_conv_18 = _res_vals[s];
16263 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
16264 CHECK_ACCESS(_res_conv_18_ptr);
16265 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
16266 FREE((void*)_res_conv_18);
16267 _res_constr.data[s] = _res_conv_18_conv;
16269 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
16270 CVec_MessageSendEventZ_free(_res_constr);
16273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16274 LDKFixedPenaltyScorer o_conv;
16275 o_conv.inner = (void*)(o & (~1));
16276 o_conv.is_owned = (o & 1) || (o == 0);
16277 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16278 o_conv = FixedPenaltyScorer_clone(&o_conv);
16279 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16280 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
16281 return (int64_t)ret_conv;
16284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16285 LDKDecodeError e_conv;
16286 e_conv.inner = (void*)(e & (~1));
16287 e_conv.is_owned = (e & 1) || (e == 0);
16288 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16289 e_conv = DecodeError_clone(&e_conv);
16290 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16291 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
16292 return (int64_t)ret_conv;
16295 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16296 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
16297 jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
16301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16302 if ((_res & 1) != 0) return;
16303 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16304 CHECK_ACCESS(_res_ptr);
16305 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
16307 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
16310 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
16311 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16312 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
16313 return (int64_t)ret_conv;
16315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16316 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
16317 int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
16321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16322 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
16323 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
16324 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
16325 return (int64_t)ret_conv;
16328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16329 LDKScoringParameters o_conv;
16330 o_conv.inner = (void*)(o & (~1));
16331 o_conv.is_owned = (o & 1) || (o == 0);
16332 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16333 o_conv = ScoringParameters_clone(&o_conv);
16334 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
16335 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
16336 return (int64_t)ret_conv;
16339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16340 LDKDecodeError e_conv;
16341 e_conv.inner = (void*)(e & (~1));
16342 e_conv.is_owned = (e & 1) || (e == 0);
16343 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16344 e_conv = DecodeError_clone(&e_conv);
16345 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
16346 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
16347 return (int64_t)ret_conv;
16350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16351 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
16352 jboolean ret_conv = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
16356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16357 if ((_res & 1) != 0) return;
16358 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16359 CHECK_ACCESS(_res_ptr);
16360 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
16362 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
16365 static inline uintptr_t CResult_ScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR arg) {
16366 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
16367 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(arg);
16368 return (int64_t)ret_conv;
16370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16371 LDKCResult_ScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
16372 int64_t ret_conv = CResult_ScoringParametersDecodeErrorZ_clone_ptr(arg_conv);
16376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16377 LDKCResult_ScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(orig & ~1);
16378 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
16379 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(orig_conv);
16380 return (int64_t)ret_conv;
16383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16385 o_conv.inner = (void*)(o & (~1));
16386 o_conv.is_owned = (o & 1) || (o == 0);
16387 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16388 // WARNING: we need a move here but no clone is available for LDKScorer
16389 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
16390 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
16391 return (int64_t)ret_conv;
16394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16395 LDKDecodeError e_conv;
16396 e_conv.inner = (void*)(e & (~1));
16397 e_conv.is_owned = (e & 1) || (e == 0);
16398 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16399 e_conv = DecodeError_clone(&e_conv);
16400 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
16401 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
16402 return (int64_t)ret_conv;
16405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16406 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
16407 jboolean ret_conv = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
16411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16412 if ((_res & 1) != 0) return;
16413 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16414 CHECK_ACCESS(_res_ptr);
16415 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
16417 CResult_ScorerDecodeErrorZ_free(_res_conv);
16420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16421 LDKProbabilisticScorer o_conv;
16422 o_conv.inner = (void*)(o & (~1));
16423 o_conv.is_owned = (o & 1) || (o == 0);
16424 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16425 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
16426 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16427 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
16428 return (int64_t)ret_conv;
16431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16432 LDKDecodeError e_conv;
16433 e_conv.inner = (void*)(e & (~1));
16434 e_conv.is_owned = (e & 1) || (e == 0);
16435 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16436 e_conv = DecodeError_clone(&e_conv);
16437 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16438 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
16439 return (int64_t)ret_conv;
16442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16443 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
16444 jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
16448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16449 if ((_res & 1) != 0) return;
16450 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16451 CHECK_ACCESS(_res_ptr);
16452 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
16454 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
16457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16458 LDKInitFeatures o_conv;
16459 o_conv.inner = (void*)(o & (~1));
16460 o_conv.is_owned = (o & 1) || (o == 0);
16461 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16462 o_conv = InitFeatures_clone(&o_conv);
16463 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16464 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
16465 return (int64_t)ret_conv;
16468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16469 LDKDecodeError e_conv;
16470 e_conv.inner = (void*)(e & (~1));
16471 e_conv.is_owned = (e & 1) || (e == 0);
16472 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16473 e_conv = DecodeError_clone(&e_conv);
16474 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16475 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
16476 return (int64_t)ret_conv;
16479 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16480 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
16481 jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
16485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16486 if ((_res & 1) != 0) return;
16487 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16488 CHECK_ACCESS(_res_ptr);
16489 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
16491 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
16494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16495 LDKChannelFeatures o_conv;
16496 o_conv.inner = (void*)(o & (~1));
16497 o_conv.is_owned = (o & 1) || (o == 0);
16498 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16499 o_conv = ChannelFeatures_clone(&o_conv);
16500 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16501 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
16502 return (int64_t)ret_conv;
16505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16506 LDKDecodeError e_conv;
16507 e_conv.inner = (void*)(e & (~1));
16508 e_conv.is_owned = (e & 1) || (e == 0);
16509 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16510 e_conv = DecodeError_clone(&e_conv);
16511 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16512 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
16513 return (int64_t)ret_conv;
16516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16517 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
16518 jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
16522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16523 if ((_res & 1) != 0) return;
16524 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16525 CHECK_ACCESS(_res_ptr);
16526 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
16528 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
16531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16532 LDKNodeFeatures o_conv;
16533 o_conv.inner = (void*)(o & (~1));
16534 o_conv.is_owned = (o & 1) || (o == 0);
16535 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16536 o_conv = NodeFeatures_clone(&o_conv);
16537 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16538 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
16539 return (int64_t)ret_conv;
16542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16543 LDKDecodeError e_conv;
16544 e_conv.inner = (void*)(e & (~1));
16545 e_conv.is_owned = (e & 1) || (e == 0);
16546 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16547 e_conv = DecodeError_clone(&e_conv);
16548 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16549 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
16550 return (int64_t)ret_conv;
16553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16554 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
16555 jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
16559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16560 if ((_res & 1) != 0) return;
16561 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16562 CHECK_ACCESS(_res_ptr);
16563 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
16565 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
16568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16569 LDKInvoiceFeatures o_conv;
16570 o_conv.inner = (void*)(o & (~1));
16571 o_conv.is_owned = (o & 1) || (o == 0);
16572 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16573 o_conv = InvoiceFeatures_clone(&o_conv);
16574 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16575 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
16576 return (int64_t)ret_conv;
16579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16580 LDKDecodeError e_conv;
16581 e_conv.inner = (void*)(e & (~1));
16582 e_conv.is_owned = (e & 1) || (e == 0);
16583 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16584 e_conv = DecodeError_clone(&e_conv);
16585 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16586 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
16587 return (int64_t)ret_conv;
16590 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16591 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
16592 jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
16596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16597 if ((_res & 1) != 0) return;
16598 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16599 CHECK_ACCESS(_res_ptr);
16600 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
16602 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
16605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16606 LDKChannelTypeFeatures o_conv;
16607 o_conv.inner = (void*)(o & (~1));
16608 o_conv.is_owned = (o & 1) || (o == 0);
16609 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16610 o_conv = ChannelTypeFeatures_clone(&o_conv);
16611 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16612 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
16613 return (int64_t)ret_conv;
16616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16617 LDKDecodeError e_conv;
16618 e_conv.inner = (void*)(e & (~1));
16619 e_conv.is_owned = (e & 1) || (e == 0);
16620 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16621 e_conv = DecodeError_clone(&e_conv);
16622 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16623 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
16624 return (int64_t)ret_conv;
16627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16628 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
16629 jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
16633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16634 if ((_res & 1) != 0) return;
16635 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16636 CHECK_ACCESS(_res_ptr);
16637 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
16639 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
16642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16643 LDKDelayedPaymentOutputDescriptor o_conv;
16644 o_conv.inner = (void*)(o & (~1));
16645 o_conv.is_owned = (o & 1) || (o == 0);
16646 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16647 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
16648 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16649 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16650 return (int64_t)ret_conv;
16653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16654 LDKDecodeError e_conv;
16655 e_conv.inner = (void*)(e & (~1));
16656 e_conv.is_owned = (e & 1) || (e == 0);
16657 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16658 e_conv = DecodeError_clone(&e_conv);
16659 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16660 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16661 return (int64_t)ret_conv;
16664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16665 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
16666 jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16671 if ((_res & 1) != 0) return;
16672 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16673 CHECK_ACCESS(_res_ptr);
16674 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16676 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16679 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16680 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16681 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16682 return (int64_t)ret_conv;
16684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16685 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
16686 int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16691 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
16692 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16693 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16694 return (int64_t)ret_conv;
16697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16698 LDKStaticPaymentOutputDescriptor o_conv;
16699 o_conv.inner = (void*)(o & (~1));
16700 o_conv.is_owned = (o & 1) || (o == 0);
16701 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16702 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
16703 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16704 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16705 return (int64_t)ret_conv;
16708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16709 LDKDecodeError e_conv;
16710 e_conv.inner = (void*)(e & (~1));
16711 e_conv.is_owned = (e & 1) || (e == 0);
16712 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16713 e_conv = DecodeError_clone(&e_conv);
16714 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16715 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16716 return (int64_t)ret_conv;
16719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16720 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
16721 jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16726 if ((_res & 1) != 0) return;
16727 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16728 CHECK_ACCESS(_res_ptr);
16729 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16731 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16734 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16735 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16736 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16737 return (int64_t)ret_conv;
16739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16740 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
16741 int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16746 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
16747 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16748 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16749 return (int64_t)ret_conv;
16752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16753 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16754 CHECK_ACCESS(o_ptr);
16755 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
16756 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
16757 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16758 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
16759 return (int64_t)ret_conv;
16762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16763 LDKDecodeError e_conv;
16764 e_conv.inner = (void*)(e & (~1));
16765 e_conv.is_owned = (e & 1) || (e == 0);
16766 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16767 e_conv = DecodeError_clone(&e_conv);
16768 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16769 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
16770 return (int64_t)ret_conv;
16773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16774 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
16775 jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16780 if ((_res & 1) != 0) return;
16781 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16782 CHECK_ACCESS(_res_ptr);
16783 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
16785 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
16788 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16789 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16790 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
16791 return (int64_t)ret_conv;
16793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16794 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
16795 int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16800 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
16801 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16802 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
16803 return (int64_t)ret_conv;
16806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16807 LDKCVec_PaymentPreimageZ _res_constr;
16808 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16809 if (_res_constr.datalen > 0)
16810 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
16812 _res_constr.data = NULL;
16813 for (size_t i = 0; i < _res_constr.datalen; i++) {
16814 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16815 LDKThirtyTwoBytes _res_conv_8_ref;
16816 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
16817 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
16818 _res_constr.data[i] = _res_conv_8_ref;
16820 CVec_PaymentPreimageZ_free(_res_constr);
16823 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
16824 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16825 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
16826 return ((int64_t)ret_conv);
16828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16829 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
16830 int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
16834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16835 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
16836 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16837 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
16838 return ((int64_t)ret_conv);
16841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
16842 LDKSignature a_ref;
16843 CHECK((*env)->GetArrayLength(env, a) == 64);
16844 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
16845 LDKCVec_SignatureZ b_constr;
16846 b_constr.datalen = (*env)->GetArrayLength(env, b);
16847 if (b_constr.datalen > 0)
16848 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16850 b_constr.data = NULL;
16851 for (size_t i = 0; i < b_constr.datalen; i++) {
16852 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
16853 LDKSignature b_conv_8_ref;
16854 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
16855 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
16856 b_constr.data[i] = b_conv_8_ref;
16858 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16859 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
16860 return ((int64_t)ret_conv);
16863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16864 if ((_res & 1) != 0) return;
16865 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16866 CHECK_ACCESS(_res_ptr);
16867 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
16869 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
16872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16873 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16874 CHECK_ACCESS(o_ptr);
16875 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
16876 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
16877 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16878 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
16879 return (int64_t)ret_conv;
16882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
16883 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16884 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
16885 return (int64_t)ret_conv;
16888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16889 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
16890 jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
16894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16895 if ((_res & 1) != 0) return;
16896 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16897 CHECK_ACCESS(_res_ptr);
16898 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
16900 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
16903 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
16904 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16905 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
16906 return (int64_t)ret_conv;
16908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16909 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
16910 int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
16914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16915 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
16916 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16917 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
16918 return (int64_t)ret_conv;
16921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16922 LDKSignature o_ref;
16923 CHECK((*env)->GetArrayLength(env, o) == 64);
16924 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
16925 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16926 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
16927 return (int64_t)ret_conv;
16930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
16931 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16932 *ret_conv = CResult_SignatureNoneZ_err();
16933 return (int64_t)ret_conv;
16936 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16937 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
16938 jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
16942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16943 if ((_res & 1) != 0) return;
16944 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16945 CHECK_ACCESS(_res_ptr);
16946 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
16948 CResult_SignatureNoneZ_free(_res_conv);
16951 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
16952 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16953 *ret_conv = CResult_SignatureNoneZ_clone(arg);
16954 return (int64_t)ret_conv;
16956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16957 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
16958 int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
16962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16963 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
16964 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16965 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
16966 return (int64_t)ret_conv;
16969 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
16970 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16971 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
16972 return ((int64_t)ret_conv);
16974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16975 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
16976 int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
16980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16981 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
16982 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16983 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
16984 return ((int64_t)ret_conv);
16987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
16988 LDKSignature a_ref;
16989 CHECK((*env)->GetArrayLength(env, a) == 64);
16990 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
16991 LDKSignature b_ref;
16992 CHECK((*env)->GetArrayLength(env, b) == 64);
16993 (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
16994 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16995 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
16996 return ((int64_t)ret_conv);
16999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17000 if ((_res & 1) != 0) return;
17001 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17002 CHECK_ACCESS(_res_ptr);
17003 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
17005 C2Tuple_SignatureSignatureZ_free(_res_conv);
17008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17009 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17010 CHECK_ACCESS(o_ptr);
17011 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
17012 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
17013 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17014 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
17015 return (int64_t)ret_conv;
17018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
17019 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17020 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
17021 return (int64_t)ret_conv;
17024 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17025 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
17026 jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
17030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17031 if ((_res & 1) != 0) return;
17032 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17033 CHECK_ACCESS(_res_ptr);
17034 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
17036 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
17039 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
17040 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17041 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
17042 return (int64_t)ret_conv;
17044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17045 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
17046 int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
17050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17051 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
17052 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
17053 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
17054 return (int64_t)ret_conv;
17057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17058 LDKSecretKey o_ref;
17059 CHECK((*env)->GetArrayLength(env, o) == 32);
17060 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
17061 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17062 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
17063 return (int64_t)ret_conv;
17066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
17067 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17068 *ret_conv = CResult_SecretKeyNoneZ_err();
17069 return (int64_t)ret_conv;
17072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17073 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
17074 jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
17078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17079 if ((_res & 1) != 0) return;
17080 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17081 CHECK_ACCESS(_res_ptr);
17082 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
17084 CResult_SecretKeyNoneZ_free(_res_conv);
17087 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
17088 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17089 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
17090 return (int64_t)ret_conv;
17092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17093 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
17094 int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
17098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17099 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
17100 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
17101 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
17102 return (int64_t)ret_conv;
17105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17106 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17107 CHECK_ACCESS(o_ptr);
17108 LDKSign o_conv = *(LDKSign*)(o_ptr);
17109 if (o_conv.free == LDKSign_JCalls_free) {
17110 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17111 LDKSign_JCalls_cloned(&o_conv);
17113 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17114 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
17115 return (int64_t)ret_conv;
17118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17119 LDKDecodeError e_conv;
17120 e_conv.inner = (void*)(e & (~1));
17121 e_conv.is_owned = (e & 1) || (e == 0);
17122 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17123 e_conv = DecodeError_clone(&e_conv);
17124 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17125 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
17126 return (int64_t)ret_conv;
17129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17130 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
17131 jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
17135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17136 if ((_res & 1) != 0) return;
17137 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17138 CHECK_ACCESS(_res_ptr);
17139 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
17141 CResult_SignDecodeErrorZ_free(_res_conv);
17144 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
17145 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17146 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
17147 return (int64_t)ret_conv;
17149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17150 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
17151 int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
17155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17156 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
17157 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
17158 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
17159 return (int64_t)ret_conv;
17162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17163 LDKCVec_u5Z _res_constr;
17164 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17165 if (_res_constr.datalen > 0)
17166 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
17168 _res_constr.data = NULL;
17169 int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
17170 for (size_t h = 0; h < _res_constr.datalen; h++) {
17171 int8_t _res_conv_7 = _res_vals[h];
17173 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
17175 (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
17176 CVec_u5Z_free(_res_constr);
17179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17180 LDKRecoverableSignature o_ref;
17181 CHECK((*env)->GetArrayLength(env, o) == 68);
17182 (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
17183 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17184 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
17185 return (int64_t)ret_conv;
17188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
17189 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17190 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
17191 return (int64_t)ret_conv;
17194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17195 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
17196 jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
17200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17201 if ((_res & 1) != 0) return;
17202 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17203 CHECK_ACCESS(_res_ptr);
17204 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
17206 CResult_RecoverableSignatureNoneZ_free(_res_conv);
17209 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
17210 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17211 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
17212 return (int64_t)ret_conv;
17214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17215 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
17216 int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
17220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17221 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
17222 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
17223 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
17224 return (int64_t)ret_conv;
17227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
17228 LDKCVec_u8Z _res_ref;
17229 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
17230 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
17231 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
17232 CVec_u8Z_free(_res_ref);
17235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
17236 LDKCVec_CVec_u8ZZ _res_constr;
17237 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17238 if (_res_constr.datalen > 0)
17239 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
17241 _res_constr.data = NULL;
17242 for (size_t i = 0; i < _res_constr.datalen; i++) {
17243 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
17244 LDKCVec_u8Z _res_conv_8_ref;
17245 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
17246 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
17247 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
17248 _res_constr.data[i] = _res_conv_8_ref;
17250 CVec_CVec_u8ZZ_free(_res_constr);
17253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
17254 LDKCVec_CVec_u8ZZ o_constr;
17255 o_constr.datalen = (*env)->GetArrayLength(env, o);
17256 if (o_constr.datalen > 0)
17257 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
17259 o_constr.data = NULL;
17260 for (size_t i = 0; i < o_constr.datalen; i++) {
17261 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
17262 LDKCVec_u8Z o_conv_8_ref;
17263 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
17264 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
17265 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
17266 o_constr.data[i] = o_conv_8_ref;
17268 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17269 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
17270 return (int64_t)ret_conv;
17273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
17274 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17275 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
17276 return (int64_t)ret_conv;
17279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17280 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
17281 jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
17285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17286 if ((_res & 1) != 0) return;
17287 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17288 CHECK_ACCESS(_res_ptr);
17289 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
17291 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
17294 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
17295 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17296 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
17297 return (int64_t)ret_conv;
17299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17300 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
17301 int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
17305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17306 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
17307 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17308 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
17309 return (int64_t)ret_conv;
17312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17313 LDKInMemorySigner o_conv;
17314 o_conv.inner = (void*)(o & (~1));
17315 o_conv.is_owned = (o & 1) || (o == 0);
17316 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17317 o_conv = InMemorySigner_clone(&o_conv);
17318 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17319 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
17320 return (int64_t)ret_conv;
17323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17324 LDKDecodeError e_conv;
17325 e_conv.inner = (void*)(e & (~1));
17326 e_conv.is_owned = (e & 1) || (e == 0);
17327 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17328 e_conv = DecodeError_clone(&e_conv);
17329 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17330 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
17331 return (int64_t)ret_conv;
17334 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17335 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
17336 jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
17340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17341 if ((_res & 1) != 0) return;
17342 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17343 CHECK_ACCESS(_res_ptr);
17344 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
17346 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
17349 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
17350 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17351 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
17352 return (int64_t)ret_conv;
17354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17355 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
17356 int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
17360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17361 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
17362 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17363 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
17364 return (int64_t)ret_conv;
17367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17368 LDKCVec_TxOutZ _res_constr;
17369 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17370 if (_res_constr.datalen > 0)
17371 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17373 _res_constr.data = NULL;
17374 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17375 for (size_t h = 0; h < _res_constr.datalen; h++) {
17376 int64_t _res_conv_7 = _res_vals[h];
17377 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
17378 CHECK_ACCESS(_res_conv_7_ptr);
17379 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
17380 FREE((void*)_res_conv_7);
17381 _res_constr.data[h] = _res_conv_7_conv;
17383 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17384 CVec_TxOutZ_free(_res_constr);
17387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17388 LDKTransaction o_ref;
17389 o_ref.datalen = (*env)->GetArrayLength(env, o);
17390 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
17391 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
17392 o_ref.data_is_owned = true;
17393 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17394 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
17395 return (int64_t)ret_conv;
17398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
17399 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17400 *ret_conv = CResult_TransactionNoneZ_err();
17401 return (int64_t)ret_conv;
17404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17405 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
17406 jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
17410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17411 if ((_res & 1) != 0) return;
17412 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17413 CHECK_ACCESS(_res_ptr);
17414 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
17416 CResult_TransactionNoneZ_free(_res_conv);
17419 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
17420 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17421 *ret_conv = CResult_TransactionNoneZ_clone(arg);
17422 return (int64_t)ret_conv;
17424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17425 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
17426 int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
17430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17431 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
17432 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17433 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
17434 return (int64_t)ret_conv;
17437 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
17438 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17439 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
17440 return ((int64_t)ret_conv);
17442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17443 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
17444 int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
17448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17449 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
17450 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17451 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
17452 return ((int64_t)ret_conv);
17455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
17456 LDKThirtyTwoBytes a_ref;
17457 CHECK((*env)->GetArrayLength(env, a) == 32);
17458 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17459 LDKChannelMonitor b_conv;
17460 b_conv.inner = (void*)(b & (~1));
17461 b_conv.is_owned = (b & 1) || (b == 0);
17462 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17463 b_conv = ChannelMonitor_clone(&b_conv);
17464 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17465 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
17466 return ((int64_t)ret_conv);
17469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17470 if ((_res & 1) != 0) return;
17471 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17472 CHECK_ACCESS(_res_ptr);
17473 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
17475 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
17478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17479 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
17480 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17481 if (_res_constr.datalen > 0)
17482 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
17484 _res_constr.data = NULL;
17485 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17486 for (size_t j = 0; j < _res_constr.datalen; j++) {
17487 int64_t _res_conv_35 = _res_vals[j];
17488 void* _res_conv_35_ptr = (void*)(((uintptr_t)_res_conv_35) & ~1);
17489 CHECK_ACCESS(_res_conv_35_ptr);
17490 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
17491 FREE((void*)_res_conv_35);
17492 _res_constr.data[j] = _res_conv_35_conv;
17494 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17495 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
17498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
17499 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
17500 o_constr.datalen = (*env)->GetArrayLength(env, o);
17501 if (o_constr.datalen > 0)
17502 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
17504 o_constr.data = NULL;
17505 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
17506 for (size_t j = 0; j < o_constr.datalen; j++) {
17507 int64_t o_conv_35 = o_vals[j];
17508 void* o_conv_35_ptr = (void*)(((uintptr_t)o_conv_35) & ~1);
17509 CHECK_ACCESS(o_conv_35_ptr);
17510 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
17511 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o_conv_35) & ~1));
17512 o_constr.data[j] = o_conv_35_conv;
17514 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
17515 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17516 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
17517 return (int64_t)ret_conv;
17520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17521 LDKIOError e_conv = LDKIOError_from_java(env, e);
17522 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17523 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
17524 return (int64_t)ret_conv;
17527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17528 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
17529 jboolean ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
17533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17534 if ((_res & 1) != 0) return;
17535 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17536 CHECK_ACCESS(_res_ptr);
17537 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
17539 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
17542 static inline uintptr_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
17543 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17544 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
17545 return (int64_t)ret_conv;
17547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17548 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
17549 int64_t ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
17553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17554 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
17555 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17556 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
17557 return (int64_t)ret_conv;
17560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
17561 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17562 *ret_copy = COption_u16Z_some(o);
17563 int64_t ret_ref = (uintptr_t)ret_copy;
17567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
17568 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17569 *ret_copy = COption_u16Z_none();
17570 int64_t ret_ref = (uintptr_t)ret_copy;
17574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
17575 if ((_res & 1) != 0) return;
17576 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17577 CHECK_ACCESS(_res_ptr);
17578 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
17580 COption_u16Z_free(_res_conv);
17583 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
17584 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17585 *ret_copy = COption_u16Z_clone(arg);
17586 int64_t ret_ref = (uintptr_t)ret_copy;
17589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17590 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
17591 int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
17595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17596 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
17597 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17598 *ret_copy = COption_u16Z_clone(orig_conv);
17599 int64_t ret_ref = (uintptr_t)ret_copy;
17603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
17604 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17605 *ret_conv = CResult_NoneAPIErrorZ_ok();
17606 return (int64_t)ret_conv;
17609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17610 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17611 CHECK_ACCESS(e_ptr);
17612 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17613 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17614 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17615 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
17616 return (int64_t)ret_conv;
17619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17620 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
17621 jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
17625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17626 if ((_res & 1) != 0) return;
17627 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17628 CHECK_ACCESS(_res_ptr);
17629 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
17631 CResult_NoneAPIErrorZ_free(_res_conv);
17634 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
17635 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17636 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
17637 return (int64_t)ret_conv;
17639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17640 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
17641 int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
17645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17646 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
17647 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17648 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
17649 return (int64_t)ret_conv;
17652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17653 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
17654 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17655 if (_res_constr.datalen > 0)
17656 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17658 _res_constr.data = NULL;
17659 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17660 for (size_t w = 0; w < _res_constr.datalen; w++) {
17661 int64_t _res_conv_22 = _res_vals[w];
17662 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
17663 CHECK_ACCESS(_res_conv_22_ptr);
17664 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
17665 FREE((void*)_res_conv_22);
17666 _res_constr.data[w] = _res_conv_22_conv;
17668 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17669 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
17672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17673 LDKCVec_APIErrorZ _res_constr;
17674 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17675 if (_res_constr.datalen > 0)
17676 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
17678 _res_constr.data = NULL;
17679 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17680 for (size_t k = 0; k < _res_constr.datalen; k++) {
17681 int64_t _res_conv_10 = _res_vals[k];
17682 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
17683 CHECK_ACCESS(_res_conv_10_ptr);
17684 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
17685 FREE((void*)_res_conv_10);
17686 _res_constr.data[k] = _res_conv_10_conv;
17688 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17689 CVec_APIErrorZ_free(_res_constr);
17692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17693 LDKThirtyTwoBytes o_ref;
17694 CHECK((*env)->GetArrayLength(env, o) == 32);
17695 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17696 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17697 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
17698 return (int64_t)ret_conv;
17701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17702 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17703 CHECK_ACCESS(e_ptr);
17704 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17705 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17706 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17707 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
17708 return (int64_t)ret_conv;
17711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17712 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
17713 jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
17717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17718 if ((_res & 1) != 0) return;
17719 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17720 CHECK_ACCESS(_res_ptr);
17721 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
17723 CResult__u832APIErrorZ_free(_res_conv);
17726 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
17727 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17728 *ret_conv = CResult__u832APIErrorZ_clone(arg);
17729 return (int64_t)ret_conv;
17731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17732 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
17733 int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
17737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17738 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
17739 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17740 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
17741 return (int64_t)ret_conv;
17744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17745 LDKThirtyTwoBytes o_ref;
17746 CHECK((*env)->GetArrayLength(env, o) == 32);
17747 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17748 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17749 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
17750 return (int64_t)ret_conv;
17753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17754 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17755 CHECK_ACCESS(e_ptr);
17756 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17757 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17758 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17759 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
17760 return (int64_t)ret_conv;
17763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17764 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
17765 jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
17769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17770 if ((_res & 1) != 0) return;
17771 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17772 CHECK_ACCESS(_res_ptr);
17773 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
17775 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
17778 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
17779 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17780 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
17781 return (int64_t)ret_conv;
17783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17784 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
17785 int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
17789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17790 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
17791 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17792 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
17793 return (int64_t)ret_conv;
17796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
17797 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17798 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
17799 return (int64_t)ret_conv;
17802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17803 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17804 CHECK_ACCESS(e_ptr);
17805 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17806 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17807 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17808 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
17809 return (int64_t)ret_conv;
17812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17813 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
17814 jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
17818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17819 if ((_res & 1) != 0) return;
17820 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17821 CHECK_ACCESS(_res_ptr);
17822 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
17824 CResult_NonePaymentSendFailureZ_free(_res_conv);
17827 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
17828 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17829 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
17830 return (int64_t)ret_conv;
17832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17833 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
17834 int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
17838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17839 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
17840 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17841 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
17842 return (int64_t)ret_conv;
17845 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
17846 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17847 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
17848 return ((int64_t)ret_conv);
17850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17851 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
17852 int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
17856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17857 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
17858 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17859 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
17860 return ((int64_t)ret_conv);
17863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17864 LDKThirtyTwoBytes a_ref;
17865 CHECK((*env)->GetArrayLength(env, a) == 32);
17866 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17867 LDKThirtyTwoBytes b_ref;
17868 CHECK((*env)->GetArrayLength(env, b) == 32);
17869 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
17870 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17871 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
17872 return ((int64_t)ret_conv);
17875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17876 if ((_res & 1) != 0) return;
17877 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17878 CHECK_ACCESS(_res_ptr);
17879 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
17881 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
17884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17885 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17886 CHECK_ACCESS(o_ptr);
17887 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
17888 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
17889 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17890 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
17891 return (int64_t)ret_conv;
17894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17895 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17896 CHECK_ACCESS(e_ptr);
17897 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17898 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17899 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17900 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
17901 return (int64_t)ret_conv;
17904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17905 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
17906 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
17910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17911 if ((_res & 1) != 0) return;
17912 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17913 CHECK_ACCESS(_res_ptr);
17914 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
17916 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
17919 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
17920 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17921 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
17922 return (int64_t)ret_conv;
17924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17925 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
17926 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
17930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17931 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
17932 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17933 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
17934 return (int64_t)ret_conv;
17937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17938 LDKCVec_NetAddressZ _res_constr;
17939 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17940 if (_res_constr.datalen > 0)
17941 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17943 _res_constr.data = NULL;
17944 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17945 for (size_t m = 0; m < _res_constr.datalen; m++) {
17946 int64_t _res_conv_12 = _res_vals[m];
17947 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
17948 CHECK_ACCESS(_res_conv_12_ptr);
17949 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
17950 FREE((void*)_res_conv_12);
17951 _res_constr.data[m] = _res_conv_12_conv;
17953 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17954 CVec_NetAddressZ_free(_res_constr);
17957 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
17958 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17959 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
17960 return ((int64_t)ret_conv);
17962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17963 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
17964 int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
17968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17969 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
17970 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17971 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
17972 return ((int64_t)ret_conv);
17975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17976 LDKThirtyTwoBytes a_ref;
17977 CHECK((*env)->GetArrayLength(env, a) == 32);
17978 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17979 LDKThirtyTwoBytes b_ref;
17980 CHECK((*env)->GetArrayLength(env, b) == 32);
17981 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
17982 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17983 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
17984 return ((int64_t)ret_conv);
17987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17988 if ((_res & 1) != 0) return;
17989 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17990 CHECK_ACCESS(_res_ptr);
17991 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
17993 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
17996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17997 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17998 CHECK_ACCESS(o_ptr);
17999 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
18000 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
18001 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18002 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
18003 return (int64_t)ret_conv;
18006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
18007 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18008 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
18009 return (int64_t)ret_conv;
18012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18013 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
18014 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
18018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18019 if ((_res & 1) != 0) return;
18020 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18021 CHECK_ACCESS(_res_ptr);
18022 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
18024 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
18027 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
18028 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18029 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
18030 return (int64_t)ret_conv;
18032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18033 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
18034 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
18038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18039 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
18040 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
18041 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
18042 return (int64_t)ret_conv;
18045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18046 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18047 CHECK_ACCESS(o_ptr);
18048 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
18049 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
18050 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18051 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
18052 return (int64_t)ret_conv;
18055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18056 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18057 CHECK_ACCESS(e_ptr);
18058 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18059 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
18060 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18061 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
18062 return (int64_t)ret_conv;
18065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18066 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
18067 jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
18071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18072 if ((_res & 1) != 0) return;
18073 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18074 CHECK_ACCESS(_res_ptr);
18075 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
18077 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
18080 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
18081 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18082 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
18083 return (int64_t)ret_conv;
18085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18086 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
18087 int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
18091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18092 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
18093 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
18094 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
18095 return (int64_t)ret_conv;
18098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18099 LDKThirtyTwoBytes o_ref;
18100 CHECK((*env)->GetArrayLength(env, o) == 32);
18101 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18102 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18103 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
18104 return (int64_t)ret_conv;
18107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
18108 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18109 *ret_conv = CResult_PaymentSecretNoneZ_err();
18110 return (int64_t)ret_conv;
18113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18114 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
18115 jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
18119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18120 if ((_res & 1) != 0) return;
18121 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18122 CHECK_ACCESS(_res_ptr);
18123 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
18125 CResult_PaymentSecretNoneZ_free(_res_conv);
18128 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
18129 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18130 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
18131 return (int64_t)ret_conv;
18133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18134 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
18135 int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
18139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18140 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
18141 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
18142 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
18143 return (int64_t)ret_conv;
18146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18147 LDKThirtyTwoBytes o_ref;
18148 CHECK((*env)->GetArrayLength(env, o) == 32);
18149 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18150 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18151 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
18152 return (int64_t)ret_conv;
18155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18156 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18157 CHECK_ACCESS(e_ptr);
18158 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18159 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
18160 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18161 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
18162 return (int64_t)ret_conv;
18165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18166 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
18167 jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
18171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18172 if ((_res & 1) != 0) return;
18173 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18174 CHECK_ACCESS(_res_ptr);
18175 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
18177 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
18180 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
18181 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18182 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
18183 return (int64_t)ret_conv;
18185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18186 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
18187 int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
18191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18192 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
18193 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18194 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
18195 return (int64_t)ret_conv;
18198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18199 LDKThirtyTwoBytes o_ref;
18200 CHECK((*env)->GetArrayLength(env, o) == 32);
18201 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18202 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18203 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
18204 return (int64_t)ret_conv;
18207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18208 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18209 CHECK_ACCESS(e_ptr);
18210 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
18211 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
18212 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18213 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
18214 return (int64_t)ret_conv;
18217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18218 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
18219 jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
18223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18224 if ((_res & 1) != 0) return;
18225 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18226 CHECK_ACCESS(_res_ptr);
18227 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
18229 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
18232 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
18233 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18234 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
18235 return (int64_t)ret_conv;
18237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18238 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
18239 int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
18243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18244 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
18245 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
18246 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
18247 return (int64_t)ret_conv;
18250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18251 LDKCounterpartyForwardingInfo o_conv;
18252 o_conv.inner = (void*)(o & (~1));
18253 o_conv.is_owned = (o & 1) || (o == 0);
18254 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18255 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
18256 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18257 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
18258 return (int64_t)ret_conv;
18261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18262 LDKDecodeError e_conv;
18263 e_conv.inner = (void*)(e & (~1));
18264 e_conv.is_owned = (e & 1) || (e == 0);
18265 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18266 e_conv = DecodeError_clone(&e_conv);
18267 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18268 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
18269 return (int64_t)ret_conv;
18272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18273 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
18274 jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
18278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18279 if ((_res & 1) != 0) return;
18280 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18281 CHECK_ACCESS(_res_ptr);
18282 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
18284 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
18287 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
18288 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18289 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
18290 return (int64_t)ret_conv;
18292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18293 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
18294 int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
18298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18299 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
18300 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
18301 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
18302 return (int64_t)ret_conv;
18305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18306 LDKChannelCounterparty o_conv;
18307 o_conv.inner = (void*)(o & (~1));
18308 o_conv.is_owned = (o & 1) || (o == 0);
18309 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18310 o_conv = ChannelCounterparty_clone(&o_conv);
18311 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18312 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
18313 return (int64_t)ret_conv;
18316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18317 LDKDecodeError e_conv;
18318 e_conv.inner = (void*)(e & (~1));
18319 e_conv.is_owned = (e & 1) || (e == 0);
18320 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18321 e_conv = DecodeError_clone(&e_conv);
18322 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18323 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
18324 return (int64_t)ret_conv;
18327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18328 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
18329 jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
18333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18334 if ((_res & 1) != 0) return;
18335 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18336 CHECK_ACCESS(_res_ptr);
18337 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
18339 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
18342 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
18343 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18344 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
18345 return (int64_t)ret_conv;
18347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18348 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
18349 int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
18353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18354 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
18355 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18356 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
18357 return (int64_t)ret_conv;
18360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18361 LDKChannelDetails o_conv;
18362 o_conv.inner = (void*)(o & (~1));
18363 o_conv.is_owned = (o & 1) || (o == 0);
18364 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18365 o_conv = ChannelDetails_clone(&o_conv);
18366 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18367 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
18368 return (int64_t)ret_conv;
18371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18372 LDKDecodeError e_conv;
18373 e_conv.inner = (void*)(e & (~1));
18374 e_conv.is_owned = (e & 1) || (e == 0);
18375 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18376 e_conv = DecodeError_clone(&e_conv);
18377 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18378 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
18379 return (int64_t)ret_conv;
18382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18383 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
18384 jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
18388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18389 if ((_res & 1) != 0) return;
18390 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18391 CHECK_ACCESS(_res_ptr);
18392 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
18394 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
18397 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
18398 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18399 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
18400 return (int64_t)ret_conv;
18402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18403 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
18404 int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
18408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18409 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
18410 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18411 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
18412 return (int64_t)ret_conv;
18415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18416 LDKPhantomRouteHints o_conv;
18417 o_conv.inner = (void*)(o & (~1));
18418 o_conv.is_owned = (o & 1) || (o == 0);
18419 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18420 o_conv = PhantomRouteHints_clone(&o_conv);
18421 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18422 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
18423 return (int64_t)ret_conv;
18426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18427 LDKDecodeError e_conv;
18428 e_conv.inner = (void*)(e & (~1));
18429 e_conv.is_owned = (e & 1) || (e == 0);
18430 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18431 e_conv = DecodeError_clone(&e_conv);
18432 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18433 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
18434 return (int64_t)ret_conv;
18437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18438 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
18439 jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
18443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18444 if ((_res & 1) != 0) return;
18445 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18446 CHECK_ACCESS(_res_ptr);
18447 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
18449 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
18452 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
18453 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18454 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
18455 return (int64_t)ret_conv;
18457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18458 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
18459 int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
18463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18464 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
18465 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18466 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
18467 return (int64_t)ret_conv;
18470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18471 LDKCVec_ChannelMonitorZ _res_constr;
18472 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18473 if (_res_constr.datalen > 0)
18474 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
18476 _res_constr.data = NULL;
18477 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18478 for (size_t q = 0; q < _res_constr.datalen; q++) {
18479 int64_t _res_conv_16 = _res_vals[q];
18480 LDKChannelMonitor _res_conv_16_conv;
18481 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
18482 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
18483 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18484 _res_constr.data[q] = _res_conv_16_conv;
18486 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18487 CVec_ChannelMonitorZ_free(_res_constr);
18490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
18491 LDKThirtyTwoBytes a_ref;
18492 CHECK((*env)->GetArrayLength(env, a) == 32);
18493 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18494 LDKChannelManager b_conv;
18495 b_conv.inner = (void*)(b & (~1));
18496 b_conv.is_owned = (b & 1) || (b == 0);
18497 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18498 // WARNING: we need a move here but no clone is available for LDKChannelManager
18499 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
18500 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
18501 return ((int64_t)ret_conv);
18504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18505 if ((_res & 1) != 0) return;
18506 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18507 CHECK_ACCESS(_res_ptr);
18508 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
18510 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
18513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18514 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18515 CHECK_ACCESS(o_ptr);
18516 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
18517 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
18518 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18519 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
18520 return (int64_t)ret_conv;
18523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18524 LDKDecodeError e_conv;
18525 e_conv.inner = (void*)(e & (~1));
18526 e_conv.is_owned = (e & 1) || (e == 0);
18527 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18528 e_conv = DecodeError_clone(&e_conv);
18529 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18530 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
18531 return (int64_t)ret_conv;
18534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18535 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
18536 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
18540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18541 if ((_res & 1) != 0) return;
18542 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18543 CHECK_ACCESS(_res_ptr);
18544 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
18546 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
18549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18550 LDKChannelConfig o_conv;
18551 o_conv.inner = (void*)(o & (~1));
18552 o_conv.is_owned = (o & 1) || (o == 0);
18553 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18554 o_conv = ChannelConfig_clone(&o_conv);
18555 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18556 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
18557 return (int64_t)ret_conv;
18560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18561 LDKDecodeError e_conv;
18562 e_conv.inner = (void*)(e & (~1));
18563 e_conv.is_owned = (e & 1) || (e == 0);
18564 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18565 e_conv = DecodeError_clone(&e_conv);
18566 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18567 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
18568 return (int64_t)ret_conv;
18571 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18572 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
18573 jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
18577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18578 if ((_res & 1) != 0) return;
18579 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18580 CHECK_ACCESS(_res_ptr);
18581 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
18583 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
18586 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
18587 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18588 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
18589 return (int64_t)ret_conv;
18591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18592 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
18593 int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
18597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18598 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
18599 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18600 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
18601 return (int64_t)ret_conv;
18604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18605 LDKOutPoint o_conv;
18606 o_conv.inner = (void*)(o & (~1));
18607 o_conv.is_owned = (o & 1) || (o == 0);
18608 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18609 o_conv = OutPoint_clone(&o_conv);
18610 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18611 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
18612 return (int64_t)ret_conv;
18615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18616 LDKDecodeError e_conv;
18617 e_conv.inner = (void*)(e & (~1));
18618 e_conv.is_owned = (e & 1) || (e == 0);
18619 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18620 e_conv = DecodeError_clone(&e_conv);
18621 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18622 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
18623 return (int64_t)ret_conv;
18626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18627 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
18628 jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
18632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18633 if ((_res & 1) != 0) return;
18634 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18635 CHECK_ACCESS(_res_ptr);
18636 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
18638 CResult_OutPointDecodeErrorZ_free(_res_conv);
18641 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
18642 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18643 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
18644 return (int64_t)ret_conv;
18646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18647 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
18648 int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
18652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18653 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
18654 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18655 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
18656 return (int64_t)ret_conv;
18659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18660 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18661 CHECK_ACCESS(o_ptr);
18662 LDKType o_conv = *(LDKType*)(o_ptr);
18663 if (o_conv.free == LDKType_JCalls_free) {
18664 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18665 LDKType_JCalls_cloned(&o_conv);
18667 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18668 *ret_copy = COption_TypeZ_some(o_conv);
18669 int64_t ret_ref = (uintptr_t)ret_copy;
18673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
18674 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18675 *ret_copy = COption_TypeZ_none();
18676 int64_t ret_ref = (uintptr_t)ret_copy;
18680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18681 if ((_res & 1) != 0) return;
18682 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18683 CHECK_ACCESS(_res_ptr);
18684 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
18686 COption_TypeZ_free(_res_conv);
18689 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
18690 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18691 *ret_copy = COption_TypeZ_clone(arg);
18692 int64_t ret_ref = (uintptr_t)ret_copy;
18695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18696 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
18697 int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
18701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18702 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
18703 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18704 *ret_copy = COption_TypeZ_clone(orig_conv);
18705 int64_t ret_ref = (uintptr_t)ret_copy;
18709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18710 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18711 CHECK_ACCESS(o_ptr);
18712 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
18713 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
18714 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18715 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
18716 return (int64_t)ret_conv;
18719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18720 LDKDecodeError e_conv;
18721 e_conv.inner = (void*)(e & (~1));
18722 e_conv.is_owned = (e & 1) || (e == 0);
18723 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18724 e_conv = DecodeError_clone(&e_conv);
18725 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18726 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
18727 return (int64_t)ret_conv;
18730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18731 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
18732 jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
18736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18737 if ((_res & 1) != 0) return;
18738 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18739 CHECK_ACCESS(_res_ptr);
18740 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
18742 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
18745 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
18746 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18747 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
18748 return (int64_t)ret_conv;
18750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18751 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
18752 int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
18756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18757 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
18758 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18759 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
18760 return (int64_t)ret_conv;
18763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18764 LDKThirtyTwoBytes o_ref;
18765 CHECK((*env)->GetArrayLength(env, o) == 32);
18766 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18767 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18768 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
18769 return (int64_t)ret_conv;
18772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18773 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18774 CHECK_ACCESS(e_ptr);
18775 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18776 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
18777 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18778 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
18779 return (int64_t)ret_conv;
18782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18783 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
18784 jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
18788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18789 if ((_res & 1) != 0) return;
18790 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18791 CHECK_ACCESS(_res_ptr);
18792 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
18794 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
18797 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
18798 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18799 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
18800 return (int64_t)ret_conv;
18802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18803 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
18804 int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
18808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18809 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
18810 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18811 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
18812 return (int64_t)ret_conv;
18815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
18816 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
18817 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18818 *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
18819 return (int64_t)ret_conv;
18822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18823 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18824 CHECK_ACCESS(e_ptr);
18825 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
18826 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
18827 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18828 *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
18829 return (int64_t)ret_conv;
18832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18833 LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1);
18834 jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
18838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18839 if ((_res & 1) != 0) return;
18840 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18841 CHECK_ACCESS(_res_ptr);
18842 LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
18844 CResult_SiPrefixParseErrorZ_free(_res_conv);
18847 static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
18848 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18849 *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
18850 return (int64_t)ret_conv;
18852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18853 LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1);
18854 int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
18858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18859 LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1);
18860 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18861 *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
18862 return (int64_t)ret_conv;
18865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18867 o_conv.inner = (void*)(o & (~1));
18868 o_conv.is_owned = (o & 1) || (o == 0);
18869 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18870 o_conv = Invoice_clone(&o_conv);
18871 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18872 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
18873 return (int64_t)ret_conv;
18876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18877 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18878 CHECK_ACCESS(e_ptr);
18879 LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
18880 e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1));
18881 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18882 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
18883 return (int64_t)ret_conv;
18886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18887 LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1);
18888 jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
18892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18893 if ((_res & 1) != 0) return;
18894 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18895 CHECK_ACCESS(_res_ptr);
18896 LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
18898 CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
18901 static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
18902 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18903 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
18904 return (int64_t)ret_conv;
18906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18907 LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1);
18908 int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
18912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18913 LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1);
18914 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18915 *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
18916 return (int64_t)ret_conv;
18919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18920 LDKSignedRawInvoice o_conv;
18921 o_conv.inner = (void*)(o & (~1));
18922 o_conv.is_owned = (o & 1) || (o == 0);
18923 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18924 o_conv = SignedRawInvoice_clone(&o_conv);
18925 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18926 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
18927 return (int64_t)ret_conv;
18930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18931 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18932 CHECK_ACCESS(e_ptr);
18933 LDKParseError e_conv = *(LDKParseError*)(e_ptr);
18934 e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1));
18935 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18936 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
18937 return (int64_t)ret_conv;
18940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18941 LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1);
18942 jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
18946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18947 if ((_res & 1) != 0) return;
18948 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18949 CHECK_ACCESS(_res_ptr);
18950 LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
18952 CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
18955 static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
18956 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18957 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
18958 return (int64_t)ret_conv;
18960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18961 LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1);
18962 int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
18966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18967 LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1);
18968 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18969 *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
18970 return (int64_t)ret_conv;
18973 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
18974 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18975 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
18976 return ((int64_t)ret_conv);
18978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18979 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
18980 int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
18984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18985 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
18986 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18987 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
18988 return ((int64_t)ret_conv);
18991 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) {
18992 LDKRawInvoice a_conv;
18993 a_conv.inner = (void*)(a & (~1));
18994 a_conv.is_owned = (a & 1) || (a == 0);
18995 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18996 a_conv = RawInvoice_clone(&a_conv);
18997 LDKThirtyTwoBytes b_ref;
18998 CHECK((*env)->GetArrayLength(env, b) == 32);
18999 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
19000 LDKInvoiceSignature c_conv;
19001 c_conv.inner = (void*)(c & (~1));
19002 c_conv.is_owned = (c & 1) || (c == 0);
19003 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19004 c_conv = InvoiceSignature_clone(&c_conv);
19005 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19006 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
19007 return ((int64_t)ret_conv);
19010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19011 if ((_res & 1) != 0) return;
19012 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19013 CHECK_ACCESS(_res_ptr);
19014 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
19016 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
19019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19020 LDKPayeePubKey o_conv;
19021 o_conv.inner = (void*)(o & (~1));
19022 o_conv.is_owned = (o & 1) || (o == 0);
19023 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19024 o_conv = PayeePubKey_clone(&o_conv);
19025 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19026 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
19027 return (int64_t)ret_conv;
19030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19031 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
19032 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19033 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
19034 return (int64_t)ret_conv;
19037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19038 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
19039 jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
19043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19044 if ((_res & 1) != 0) return;
19045 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19046 CHECK_ACCESS(_res_ptr);
19047 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
19049 CResult_PayeePubKeyErrorZ_free(_res_conv);
19052 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
19053 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19054 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
19055 return (int64_t)ret_conv;
19057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19058 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
19059 int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
19063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19064 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
19065 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19066 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
19067 return (int64_t)ret_conv;
19070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19071 LDKCVec_PrivateRouteZ _res_constr;
19072 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19073 if (_res_constr.datalen > 0)
19074 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
19076 _res_constr.data = NULL;
19077 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19078 for (size_t o = 0; o < _res_constr.datalen; o++) {
19079 int64_t _res_conv_14 = _res_vals[o];
19080 LDKPrivateRoute _res_conv_14_conv;
19081 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
19082 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
19083 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19084 _res_constr.data[o] = _res_conv_14_conv;
19086 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19087 CVec_PrivateRouteZ_free(_res_constr);
19090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19091 LDKPositiveTimestamp o_conv;
19092 o_conv.inner = (void*)(o & (~1));
19093 o_conv.is_owned = (o & 1) || (o == 0);
19094 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19095 o_conv = PositiveTimestamp_clone(&o_conv);
19096 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19097 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
19098 return (int64_t)ret_conv;
19101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19102 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19103 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19104 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
19105 return (int64_t)ret_conv;
19108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19109 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
19110 jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
19114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19115 if ((_res & 1) != 0) return;
19116 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19117 CHECK_ACCESS(_res_ptr);
19118 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
19120 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
19123 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
19124 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19125 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
19126 return (int64_t)ret_conv;
19128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19129 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
19130 int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
19134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19135 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
19136 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19137 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
19138 return (int64_t)ret_conv;
19141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
19142 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19143 *ret_conv = CResult_NoneSemanticErrorZ_ok();
19144 return (int64_t)ret_conv;
19147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19148 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
19149 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19150 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
19151 return (int64_t)ret_conv;
19154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19155 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
19156 jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
19160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19161 if ((_res & 1) != 0) return;
19162 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19163 CHECK_ACCESS(_res_ptr);
19164 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
19166 CResult_NoneSemanticErrorZ_free(_res_conv);
19169 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
19170 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19171 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
19172 return (int64_t)ret_conv;
19174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19175 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
19176 int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
19180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19181 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
19182 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19183 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
19184 return (int64_t)ret_conv;
19187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19189 o_conv.inner = (void*)(o & (~1));
19190 o_conv.is_owned = (o & 1) || (o == 0);
19191 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19192 o_conv = Invoice_clone(&o_conv);
19193 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19194 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
19195 return (int64_t)ret_conv;
19198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19199 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
19200 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19201 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
19202 return (int64_t)ret_conv;
19205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19206 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
19207 jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
19211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19212 if ((_res & 1) != 0) return;
19213 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19214 CHECK_ACCESS(_res_ptr);
19215 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
19217 CResult_InvoiceSemanticErrorZ_free(_res_conv);
19220 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
19221 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19222 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
19223 return (int64_t)ret_conv;
19225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19226 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
19227 int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
19231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19232 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
19233 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19234 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
19235 return (int64_t)ret_conv;
19238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19239 LDKDescription o_conv;
19240 o_conv.inner = (void*)(o & (~1));
19241 o_conv.is_owned = (o & 1) || (o == 0);
19242 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19243 o_conv = Description_clone(&o_conv);
19244 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19245 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
19246 return (int64_t)ret_conv;
19249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19250 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19251 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19252 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
19253 return (int64_t)ret_conv;
19256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19257 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
19258 jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
19262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19263 if ((_res & 1) != 0) return;
19264 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19265 CHECK_ACCESS(_res_ptr);
19266 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
19268 CResult_DescriptionCreationErrorZ_free(_res_conv);
19271 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
19272 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19273 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
19274 return (int64_t)ret_conv;
19276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19277 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
19278 int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
19282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19283 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
19284 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19285 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
19286 return (int64_t)ret_conv;
19289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19290 LDKPrivateRoute o_conv;
19291 o_conv.inner = (void*)(o & (~1));
19292 o_conv.is_owned = (o & 1) || (o == 0);
19293 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19294 o_conv = PrivateRoute_clone(&o_conv);
19295 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19296 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
19297 return (int64_t)ret_conv;
19300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19301 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
19302 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19303 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
19304 return (int64_t)ret_conv;
19307 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19308 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
19309 jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
19313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19314 if ((_res & 1) != 0) return;
19315 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19316 CHECK_ACCESS(_res_ptr);
19317 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
19319 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
19322 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
19323 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19324 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
19325 return (int64_t)ret_conv;
19327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19328 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
19329 int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
19333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19334 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
19335 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19336 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
19337 return (int64_t)ret_conv;
19340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
19341 LDKStr o_conv = java_to_owned_str(env, o);
19342 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
19343 *ret_conv = CResult_StringErrorZ_ok(o_conv);
19344 return (int64_t)ret_conv;
19347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
19348 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
19349 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
19350 *ret_conv = CResult_StringErrorZ_err(e_conv);
19351 return (int64_t)ret_conv;
19354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19355 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
19356 jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
19360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19361 if ((_res & 1) != 0) return;
19362 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19363 CHECK_ACCESS(_res_ptr);
19364 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
19366 CResult_StringErrorZ_free(_res_conv);
19369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19370 LDKChannelMonitorUpdate o_conv;
19371 o_conv.inner = (void*)(o & (~1));
19372 o_conv.is_owned = (o & 1) || (o == 0);
19373 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19374 o_conv = ChannelMonitorUpdate_clone(&o_conv);
19375 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19376 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
19377 return (int64_t)ret_conv;
19380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19381 LDKDecodeError e_conv;
19382 e_conv.inner = (void*)(e & (~1));
19383 e_conv.is_owned = (e & 1) || (e == 0);
19384 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19385 e_conv = DecodeError_clone(&e_conv);
19386 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19387 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
19388 return (int64_t)ret_conv;
19391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19392 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
19393 jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
19397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19398 if ((_res & 1) != 0) return;
19399 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19400 CHECK_ACCESS(_res_ptr);
19401 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
19403 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
19406 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
19407 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19408 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
19409 return (int64_t)ret_conv;
19411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19412 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
19413 int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
19417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19418 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
19419 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19420 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
19421 return (int64_t)ret_conv;
19424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19425 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19426 CHECK_ACCESS(o_ptr);
19427 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
19428 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
19429 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19430 *ret_copy = COption_MonitorEventZ_some(o_conv);
19431 int64_t ret_ref = (uintptr_t)ret_copy;
19435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
19436 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19437 *ret_copy = COption_MonitorEventZ_none();
19438 int64_t ret_ref = (uintptr_t)ret_copy;
19442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19443 if ((_res & 1) != 0) return;
19444 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19445 CHECK_ACCESS(_res_ptr);
19446 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
19448 COption_MonitorEventZ_free(_res_conv);
19451 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
19452 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19453 *ret_copy = COption_MonitorEventZ_clone(arg);
19454 int64_t ret_ref = (uintptr_t)ret_copy;
19457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19458 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
19459 int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
19463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19464 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
19465 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19466 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
19467 int64_t ret_ref = (uintptr_t)ret_copy;
19471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19472 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19473 CHECK_ACCESS(o_ptr);
19474 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
19475 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
19476 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19477 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
19478 return (int64_t)ret_conv;
19481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19482 LDKDecodeError e_conv;
19483 e_conv.inner = (void*)(e & (~1));
19484 e_conv.is_owned = (e & 1) || (e == 0);
19485 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19486 e_conv = DecodeError_clone(&e_conv);
19487 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19488 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
19489 return (int64_t)ret_conv;
19492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19493 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
19494 jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
19498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19499 if ((_res & 1) != 0) return;
19500 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19501 CHECK_ACCESS(_res_ptr);
19502 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
19504 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
19507 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
19508 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19509 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
19510 return (int64_t)ret_conv;
19512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19513 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
19514 int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
19518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19519 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
19520 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19521 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
19522 return (int64_t)ret_conv;
19525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19526 LDKHTLCUpdate o_conv;
19527 o_conv.inner = (void*)(o & (~1));
19528 o_conv.is_owned = (o & 1) || (o == 0);
19529 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19530 o_conv = HTLCUpdate_clone(&o_conv);
19531 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19532 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
19533 return (int64_t)ret_conv;
19536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19537 LDKDecodeError e_conv;
19538 e_conv.inner = (void*)(e & (~1));
19539 e_conv.is_owned = (e & 1) || (e == 0);
19540 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19541 e_conv = DecodeError_clone(&e_conv);
19542 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19543 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
19544 return (int64_t)ret_conv;
19547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19548 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
19549 jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
19553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19554 if ((_res & 1) != 0) return;
19555 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19556 CHECK_ACCESS(_res_ptr);
19557 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
19559 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
19562 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
19563 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19564 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
19565 return (int64_t)ret_conv;
19567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19568 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
19569 int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
19573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19574 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
19575 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19576 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
19577 return (int64_t)ret_conv;
19580 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
19581 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19582 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
19583 return ((int64_t)ret_conv);
19585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19586 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
19587 int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
19591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19592 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
19593 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19594 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
19595 return ((int64_t)ret_conv);
19598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
19599 LDKOutPoint a_conv;
19600 a_conv.inner = (void*)(a & (~1));
19601 a_conv.is_owned = (a & 1) || (a == 0);
19602 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19603 a_conv = OutPoint_clone(&a_conv);
19605 b_ref.datalen = (*env)->GetArrayLength(env, b);
19606 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
19607 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
19608 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19609 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
19610 return ((int64_t)ret_conv);
19613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19614 if ((_res & 1) != 0) return;
19615 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19616 CHECK_ACCESS(_res_ptr);
19617 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
19619 C2Tuple_OutPointScriptZ_free(_res_conv);
19622 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
19623 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19624 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
19625 return ((int64_t)ret_conv);
19627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19628 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
19629 int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
19633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19634 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
19635 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19636 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
19637 return ((int64_t)ret_conv);
19640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
19642 b_ref.datalen = (*env)->GetArrayLength(env, b);
19643 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
19644 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
19645 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19646 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
19647 return ((int64_t)ret_conv);
19650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19651 if ((_res & 1) != 0) return;
19652 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19653 CHECK_ACCESS(_res_ptr);
19654 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
19656 C2Tuple_u32ScriptZ_free(_res_conv);
19659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19660 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
19661 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19662 if (_res_constr.datalen > 0)
19663 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
19665 _res_constr.data = NULL;
19666 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19667 for (size_t v = 0; v < _res_constr.datalen; v++) {
19668 int64_t _res_conv_21 = _res_vals[v];
19669 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
19670 CHECK_ACCESS(_res_conv_21_ptr);
19671 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
19672 FREE((void*)_res_conv_21);
19673 _res_constr.data[v] = _res_conv_21_conv;
19675 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19676 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
19679 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
19680 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19681 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
19682 return ((int64_t)ret_conv);
19684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19685 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
19686 int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
19690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19691 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
19692 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19693 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
19694 return ((int64_t)ret_conv);
19697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
19698 LDKThirtyTwoBytes a_ref;
19699 CHECK((*env)->GetArrayLength(env, a) == 32);
19700 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19701 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
19702 b_constr.datalen = (*env)->GetArrayLength(env, b);
19703 if (b_constr.datalen > 0)
19704 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
19706 b_constr.data = NULL;
19707 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
19708 for (size_t v = 0; v < b_constr.datalen; v++) {
19709 int64_t b_conv_21 = b_vals[v];
19710 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
19711 CHECK_ACCESS(b_conv_21_ptr);
19712 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
19713 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
19714 b_constr.data[v] = b_conv_21_conv;
19716 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
19717 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19718 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
19719 return ((int64_t)ret_conv);
19722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19723 if ((_res & 1) != 0) return;
19724 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19725 CHECK_ACCESS(_res_ptr);
19726 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
19728 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
19731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19732 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
19733 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19734 if (_res_constr.datalen > 0)
19735 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
19737 _res_constr.data = NULL;
19738 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19739 for (size_t o = 0; o < _res_constr.datalen; o++) {
19740 int64_t _res_conv_40 = _res_vals[o];
19741 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
19742 CHECK_ACCESS(_res_conv_40_ptr);
19743 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
19744 FREE((void*)_res_conv_40);
19745 _res_constr.data[o] = _res_conv_40_conv;
19747 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19748 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
19751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19752 LDKCVec_EventZ _res_constr;
19753 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19754 if (_res_constr.datalen > 0)
19755 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
19757 _res_constr.data = NULL;
19758 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19759 for (size_t h = 0; h < _res_constr.datalen; h++) {
19760 int64_t _res_conv_7 = _res_vals[h];
19761 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
19762 CHECK_ACCESS(_res_conv_7_ptr);
19763 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
19764 FREE((void*)_res_conv_7);
19765 _res_constr.data[h] = _res_conv_7_conv;
19767 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19768 CVec_EventZ_free(_res_constr);
19771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19772 LDKCVec_TransactionZ _res_constr;
19773 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19774 if (_res_constr.datalen > 0)
19775 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
19777 _res_constr.data = NULL;
19778 for (size_t i = 0; i < _res_constr.datalen; i++) {
19779 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19780 LDKTransaction _res_conv_8_ref;
19781 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
19782 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
19783 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
19784 _res_conv_8_ref.data_is_owned = true;
19785 _res_constr.data[i] = _res_conv_8_ref;
19787 CVec_TransactionZ_free(_res_constr);
19790 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
19791 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19792 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
19793 return ((int64_t)ret_conv);
19795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19796 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
19797 int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
19801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19802 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
19803 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19804 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
19805 return ((int64_t)ret_conv);
19808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
19809 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
19810 CHECK_ACCESS(b_ptr);
19811 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
19812 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
19813 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19814 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
19815 return ((int64_t)ret_conv);
19818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19819 if ((_res & 1) != 0) return;
19820 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19821 CHECK_ACCESS(_res_ptr);
19822 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
19824 C2Tuple_u32TxOutZ_free(_res_conv);
19827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19828 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
19829 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19830 if (_res_constr.datalen > 0)
19831 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19833 _res_constr.data = NULL;
19834 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19835 for (size_t u = 0; u < _res_constr.datalen; u++) {
19836 int64_t _res_conv_20 = _res_vals[u];
19837 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
19838 CHECK_ACCESS(_res_conv_20_ptr);
19839 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
19840 FREE((void*)_res_conv_20);
19841 _res_constr.data[u] = _res_conv_20_conv;
19843 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19844 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
19847 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
19848 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19849 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
19850 return ((int64_t)ret_conv);
19852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19853 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
19854 int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
19858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19859 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
19860 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19861 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
19862 return ((int64_t)ret_conv);
19865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
19866 LDKThirtyTwoBytes a_ref;
19867 CHECK((*env)->GetArrayLength(env, a) == 32);
19868 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19869 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
19870 b_constr.datalen = (*env)->GetArrayLength(env, b);
19871 if (b_constr.datalen > 0)
19872 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19874 b_constr.data = NULL;
19875 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
19876 for (size_t u = 0; u < b_constr.datalen; u++) {
19877 int64_t b_conv_20 = b_vals[u];
19878 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
19879 CHECK_ACCESS(b_conv_20_ptr);
19880 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
19881 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
19882 b_constr.data[u] = b_conv_20_conv;
19884 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
19885 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19886 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
19887 return ((int64_t)ret_conv);
19890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19891 if ((_res & 1) != 0) return;
19892 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19893 CHECK_ACCESS(_res_ptr);
19894 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
19896 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
19899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19900 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
19901 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19902 if (_res_constr.datalen > 0)
19903 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
19905 _res_constr.data = NULL;
19906 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19907 for (size_t n = 0; n < _res_constr.datalen; n++) {
19908 int64_t _res_conv_39 = _res_vals[n];
19909 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
19910 CHECK_ACCESS(_res_conv_39_ptr);
19911 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
19912 FREE((void*)_res_conv_39);
19913 _res_constr.data[n] = _res_conv_39_conv;
19915 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19916 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
19919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19920 LDKCVec_BalanceZ _res_constr;
19921 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19922 if (_res_constr.datalen > 0)
19923 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
19925 _res_constr.data = NULL;
19926 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19927 for (size_t j = 0; j < _res_constr.datalen; j++) {
19928 int64_t _res_conv_9 = _res_vals[j];
19929 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
19930 CHECK_ACCESS(_res_conv_9_ptr);
19931 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
19932 FREE((void*)_res_conv_9);
19933 _res_constr.data[j] = _res_conv_9_conv;
19935 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19936 CVec_BalanceZ_free(_res_constr);
19939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19940 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19941 CHECK_ACCESS(o_ptr);
19942 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
19943 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
19944 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19945 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
19946 return (int64_t)ret_conv;
19949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19950 LDKDecodeError e_conv;
19951 e_conv.inner = (void*)(e & (~1));
19952 e_conv.is_owned = (e & 1) || (e == 0);
19953 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19954 e_conv = DecodeError_clone(&e_conv);
19955 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19956 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
19957 return (int64_t)ret_conv;
19960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19961 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
19962 jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
19966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19967 if ((_res & 1) != 0) return;
19968 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19969 CHECK_ACCESS(_res_ptr);
19970 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
19972 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
19975 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
19976 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19977 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
19978 return (int64_t)ret_conv;
19980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19981 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
19982 int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
19986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19987 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
19988 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19989 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
19990 return (int64_t)ret_conv;
19993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
19994 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19995 *ret_conv = CResult_NoneLightningErrorZ_ok();
19996 return (int64_t)ret_conv;
19999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20000 LDKLightningError e_conv;
20001 e_conv.inner = (void*)(e & (~1));
20002 e_conv.is_owned = (e & 1) || (e == 0);
20003 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20004 e_conv = LightningError_clone(&e_conv);
20005 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20006 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
20007 return (int64_t)ret_conv;
20010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20011 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
20012 jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
20016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20017 if ((_res & 1) != 0) return;
20018 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20019 CHECK_ACCESS(_res_ptr);
20020 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
20022 CResult_NoneLightningErrorZ_free(_res_conv);
20025 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
20026 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20027 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
20028 return (int64_t)ret_conv;
20030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20031 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
20032 int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
20036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20037 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
20038 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
20039 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
20040 return (int64_t)ret_conv;
20043 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
20044 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20045 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
20046 return ((int64_t)ret_conv);
20048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20049 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
20050 int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
20054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20055 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
20056 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20057 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
20058 return ((int64_t)ret_conv);
20061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
20062 LDKPublicKey a_ref;
20063 CHECK((*env)->GetArrayLength(env, a) == 33);
20064 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
20065 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
20066 CHECK_ACCESS(b_ptr);
20067 LDKType b_conv = *(LDKType*)(b_ptr);
20068 if (b_conv.free == LDKType_JCalls_free) {
20069 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20070 LDKType_JCalls_cloned(&b_conv);
20072 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
20073 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
20074 return ((int64_t)ret_conv);
20077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20078 if ((_res & 1) != 0) return;
20079 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20080 CHECK_ACCESS(_res_ptr);
20081 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
20083 C2Tuple_PublicKeyTypeZ_free(_res_conv);
20086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20087 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
20088 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20089 if (_res_constr.datalen > 0)
20090 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
20092 _res_constr.data = NULL;
20093 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20094 for (size_t z = 0; z < _res_constr.datalen; z++) {
20095 int64_t _res_conv_25 = _res_vals[z];
20096 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
20097 CHECK_ACCESS(_res_conv_25_ptr);
20098 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
20099 FREE((void*)_res_conv_25);
20100 _res_constr.data[z] = _res_conv_25_conv;
20102 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20103 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
20106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
20107 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20108 *ret_conv = CResult_boolLightningErrorZ_ok(o);
20109 return (int64_t)ret_conv;
20112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20113 LDKLightningError e_conv;
20114 e_conv.inner = (void*)(e & (~1));
20115 e_conv.is_owned = (e & 1) || (e == 0);
20116 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20117 e_conv = LightningError_clone(&e_conv);
20118 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20119 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
20120 return (int64_t)ret_conv;
20123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20124 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
20125 jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
20129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20130 if ((_res & 1) != 0) return;
20131 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20132 CHECK_ACCESS(_res_ptr);
20133 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
20135 CResult_boolLightningErrorZ_free(_res_conv);
20138 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
20139 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20140 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
20141 return (int64_t)ret_conv;
20143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20144 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
20145 int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
20149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20150 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
20151 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
20152 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
20153 return (int64_t)ret_conv;
20156 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
20157 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20158 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
20159 return ((int64_t)ret_conv);
20161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20162 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
20163 int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
20167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20168 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
20169 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20170 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
20171 return ((int64_t)ret_conv);
20174 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) {
20175 LDKChannelAnnouncement a_conv;
20176 a_conv.inner = (void*)(a & (~1));
20177 a_conv.is_owned = (a & 1) || (a == 0);
20178 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
20179 a_conv = ChannelAnnouncement_clone(&a_conv);
20180 LDKChannelUpdate b_conv;
20181 b_conv.inner = (void*)(b & (~1));
20182 b_conv.is_owned = (b & 1) || (b == 0);
20183 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
20184 b_conv = ChannelUpdate_clone(&b_conv);
20185 LDKChannelUpdate c_conv;
20186 c_conv.inner = (void*)(c & (~1));
20187 c_conv.is_owned = (c & 1) || (c == 0);
20188 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
20189 c_conv = ChannelUpdate_clone(&c_conv);
20190 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
20191 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
20192 return ((int64_t)ret_conv);
20195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20196 if ((_res & 1) != 0) return;
20197 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20198 CHECK_ACCESS(_res_ptr);
20199 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
20201 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
20204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20205 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
20206 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20207 if (_res_constr.datalen > 0)
20208 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
20210 _res_constr.data = NULL;
20211 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20212 for (size_t h = 0; h < _res_constr.datalen; h++) {
20213 int64_t _res_conv_59 = _res_vals[h];
20214 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
20215 CHECK_ACCESS(_res_conv_59_ptr);
20216 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
20217 FREE((void*)_res_conv_59);
20218 _res_constr.data[h] = _res_conv_59_conv;
20220 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20221 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
20224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20225 LDKCVec_NodeAnnouncementZ _res_constr;
20226 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20227 if (_res_constr.datalen > 0)
20228 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
20230 _res_constr.data = NULL;
20231 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20232 for (size_t s = 0; s < _res_constr.datalen; s++) {
20233 int64_t _res_conv_18 = _res_vals[s];
20234 LDKNodeAnnouncement _res_conv_18_conv;
20235 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
20236 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
20237 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
20238 _res_constr.data[s] = _res_conv_18_conv;
20240 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20241 CVec_NodeAnnouncementZ_free(_res_constr);
20244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
20245 LDKCVec_PublicKeyZ _res_constr;
20246 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20247 if (_res_constr.datalen > 0)
20248 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
20250 _res_constr.data = NULL;
20251 for (size_t i = 0; i < _res_constr.datalen; i++) {
20252 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
20253 LDKPublicKey _res_conv_8_ref;
20254 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
20255 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
20256 _res_constr.data[i] = _res_conv_8_ref;
20258 CVec_PublicKeyZ_free(_res_constr);
20261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20262 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20263 CHECK_ACCESS(o_ptr);
20264 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
20265 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
20266 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20267 *ret_copy = COption_NetAddressZ_some(o_conv);
20268 int64_t ret_ref = (uintptr_t)ret_copy;
20272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) {
20273 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20274 *ret_copy = COption_NetAddressZ_none();
20275 int64_t ret_ref = (uintptr_t)ret_copy;
20279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20280 if ((_res & 1) != 0) return;
20281 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20282 CHECK_ACCESS(_res_ptr);
20283 LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
20285 COption_NetAddressZ_free(_res_conv);
20288 static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
20289 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20290 *ret_copy = COption_NetAddressZ_clone(arg);
20291 int64_t ret_ref = (uintptr_t)ret_copy;
20294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20295 LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg;
20296 int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
20300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20301 LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig;
20302 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
20303 *ret_copy = COption_NetAddressZ_clone(orig_conv);
20304 int64_t ret_ref = (uintptr_t)ret_copy;
20308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
20310 o_ref.datalen = (*env)->GetArrayLength(env, o);
20311 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
20312 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
20313 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20314 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
20315 return (int64_t)ret_conv;
20318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20319 LDKPeerHandleError e_conv;
20320 e_conv.inner = (void*)(e & (~1));
20321 e_conv.is_owned = (e & 1) || (e == 0);
20322 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20323 e_conv = PeerHandleError_clone(&e_conv);
20324 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20325 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
20326 return (int64_t)ret_conv;
20329 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20330 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
20331 jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
20335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20336 if ((_res & 1) != 0) return;
20337 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20338 CHECK_ACCESS(_res_ptr);
20339 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
20341 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
20344 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
20345 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20346 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
20347 return (int64_t)ret_conv;
20349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20350 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
20351 int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
20355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20356 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
20357 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20358 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
20359 return (int64_t)ret_conv;
20362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
20363 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20364 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
20365 return (int64_t)ret_conv;
20368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20369 LDKPeerHandleError e_conv;
20370 e_conv.inner = (void*)(e & (~1));
20371 e_conv.is_owned = (e & 1) || (e == 0);
20372 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20373 e_conv = PeerHandleError_clone(&e_conv);
20374 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20375 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
20376 return (int64_t)ret_conv;
20379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20380 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
20381 jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
20385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20386 if ((_res & 1) != 0) return;
20387 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20388 CHECK_ACCESS(_res_ptr);
20389 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
20391 CResult_NonePeerHandleErrorZ_free(_res_conv);
20394 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
20395 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20396 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
20397 return (int64_t)ret_conv;
20399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20400 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
20401 int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
20405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20406 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
20407 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20408 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
20409 return (int64_t)ret_conv;
20412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
20413 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20414 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
20415 return (int64_t)ret_conv;
20418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20419 LDKPeerHandleError e_conv;
20420 e_conv.inner = (void*)(e & (~1));
20421 e_conv.is_owned = (e & 1) || (e == 0);
20422 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20423 e_conv = PeerHandleError_clone(&e_conv);
20424 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20425 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
20426 return (int64_t)ret_conv;
20429 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20430 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
20431 jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
20435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20436 if ((_res & 1) != 0) return;
20437 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20438 CHECK_ACCESS(_res_ptr);
20439 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
20441 CResult_boolPeerHandleErrorZ_free(_res_conv);
20444 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
20445 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20446 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
20447 return (int64_t)ret_conv;
20449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20450 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
20451 int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
20455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20456 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
20457 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20458 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
20459 return (int64_t)ret_conv;
20462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20464 o_conv.inner = (void*)(o & (~1));
20465 o_conv.is_owned = (o & 1) || (o == 0);
20466 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20467 o_conv = NodeId_clone(&o_conv);
20468 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20469 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
20470 return (int64_t)ret_conv;
20473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20474 LDKDecodeError e_conv;
20475 e_conv.inner = (void*)(e & (~1));
20476 e_conv.is_owned = (e & 1) || (e == 0);
20477 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20478 e_conv = DecodeError_clone(&e_conv);
20479 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20480 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
20481 return (int64_t)ret_conv;
20484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20485 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
20486 jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
20490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20491 if ((_res & 1) != 0) return;
20492 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20493 CHECK_ACCESS(_res_ptr);
20494 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
20496 CResult_NodeIdDecodeErrorZ_free(_res_conv);
20499 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
20500 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20501 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
20502 return (int64_t)ret_conv;
20504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20505 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
20506 int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
20510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20511 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
20512 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20513 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
20514 return (int64_t)ret_conv;
20517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20518 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20519 CHECK_ACCESS(o_ptr);
20520 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
20521 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
20522 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20523 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
20524 return (int64_t)ret_conv;
20527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20528 LDKDecodeError e_conv;
20529 e_conv.inner = (void*)(e & (~1));
20530 e_conv.is_owned = (e & 1) || (e == 0);
20531 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20532 e_conv = DecodeError_clone(&e_conv);
20533 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20534 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
20535 return (int64_t)ret_conv;
20538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20539 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
20540 jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
20544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20545 if ((_res & 1) != 0) return;
20546 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20547 CHECK_ACCESS(_res_ptr);
20548 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
20550 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
20553 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
20554 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20555 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
20556 return (int64_t)ret_conv;
20558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20559 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
20560 int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
20564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20565 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
20566 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20567 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
20568 return (int64_t)ret_conv;
20571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20572 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20573 CHECK_ACCESS(o_ptr);
20574 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
20575 if (o_conv.free == LDKAccess_JCalls_free) {
20576 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20577 LDKAccess_JCalls_cloned(&o_conv);
20579 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
20580 *ret_copy = COption_AccessZ_some(o_conv);
20581 int64_t ret_ref = (uintptr_t)ret_copy;
20585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
20586 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
20587 *ret_copy = COption_AccessZ_none();
20588 int64_t ret_ref = (uintptr_t)ret_copy;
20592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20593 if ((_res & 1) != 0) return;
20594 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20595 CHECK_ACCESS(_res_ptr);
20596 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
20598 COption_AccessZ_free(_res_conv);
20601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20602 LDKChannelUpdateInfo o_conv;
20603 o_conv.inner = (void*)(o & (~1));
20604 o_conv.is_owned = (o & 1) || (o == 0);
20605 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20606 o_conv = ChannelUpdateInfo_clone(&o_conv);
20607 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20608 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
20609 return (int64_t)ret_conv;
20612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20613 LDKDecodeError e_conv;
20614 e_conv.inner = (void*)(e & (~1));
20615 e_conv.is_owned = (e & 1) || (e == 0);
20616 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20617 e_conv = DecodeError_clone(&e_conv);
20618 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20619 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
20620 return (int64_t)ret_conv;
20623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20624 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
20625 jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
20629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20630 if ((_res & 1) != 0) return;
20631 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20632 CHECK_ACCESS(_res_ptr);
20633 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
20635 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
20638 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
20639 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20640 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
20641 return (int64_t)ret_conv;
20643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20644 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
20645 int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
20649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20650 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
20651 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20652 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
20653 return (int64_t)ret_conv;
20656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20657 LDKChannelInfo o_conv;
20658 o_conv.inner = (void*)(o & (~1));
20659 o_conv.is_owned = (o & 1) || (o == 0);
20660 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20661 o_conv = ChannelInfo_clone(&o_conv);
20662 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20663 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
20664 return (int64_t)ret_conv;
20667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20668 LDKDecodeError e_conv;
20669 e_conv.inner = (void*)(e & (~1));
20670 e_conv.is_owned = (e & 1) || (e == 0);
20671 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20672 e_conv = DecodeError_clone(&e_conv);
20673 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20674 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
20675 return (int64_t)ret_conv;
20678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20679 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
20680 jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
20684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20685 if ((_res & 1) != 0) return;
20686 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20687 CHECK_ACCESS(_res_ptr);
20688 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
20690 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
20693 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
20694 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20695 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
20696 return (int64_t)ret_conv;
20698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20699 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
20700 int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
20704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20705 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
20706 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20707 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
20708 return (int64_t)ret_conv;
20711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20712 LDKRoutingFees o_conv;
20713 o_conv.inner = (void*)(o & (~1));
20714 o_conv.is_owned = (o & 1) || (o == 0);
20715 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20716 o_conv = RoutingFees_clone(&o_conv);
20717 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20718 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
20719 return (int64_t)ret_conv;
20722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20723 LDKDecodeError e_conv;
20724 e_conv.inner = (void*)(e & (~1));
20725 e_conv.is_owned = (e & 1) || (e == 0);
20726 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20727 e_conv = DecodeError_clone(&e_conv);
20728 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20729 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
20730 return (int64_t)ret_conv;
20733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20734 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
20735 jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
20739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20740 if ((_res & 1) != 0) return;
20741 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20742 CHECK_ACCESS(_res_ptr);
20743 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
20745 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
20748 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
20749 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20750 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
20751 return (int64_t)ret_conv;
20753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20754 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
20755 int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
20759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20760 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
20761 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20762 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
20763 return (int64_t)ret_conv;
20766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20767 LDKNodeAnnouncementInfo o_conv;
20768 o_conv.inner = (void*)(o & (~1));
20769 o_conv.is_owned = (o & 1) || (o == 0);
20770 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20771 o_conv = NodeAnnouncementInfo_clone(&o_conv);
20772 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20773 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
20774 return (int64_t)ret_conv;
20777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20778 LDKDecodeError e_conv;
20779 e_conv.inner = (void*)(e & (~1));
20780 e_conv.is_owned = (e & 1) || (e == 0);
20781 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20782 e_conv = DecodeError_clone(&e_conv);
20783 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20784 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
20785 return (int64_t)ret_conv;
20788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20789 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
20790 jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
20794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20795 if ((_res & 1) != 0) return;
20796 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20797 CHECK_ACCESS(_res_ptr);
20798 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
20800 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
20803 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
20804 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20805 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
20806 return (int64_t)ret_conv;
20808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20809 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
20810 int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
20814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20815 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
20816 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20817 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
20818 return (int64_t)ret_conv;
20821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20822 LDKCVec_u64Z _res_constr;
20823 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20824 if (_res_constr.datalen > 0)
20825 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20827 _res_constr.data = NULL;
20828 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20829 for (size_t g = 0; g < _res_constr.datalen; g++) {
20830 int64_t _res_conv_6 = _res_vals[g];
20831 _res_constr.data[g] = _res_conv_6;
20833 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20834 CVec_u64Z_free(_res_constr);
20837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20838 LDKNodeInfo o_conv;
20839 o_conv.inner = (void*)(o & (~1));
20840 o_conv.is_owned = (o & 1) || (o == 0);
20841 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20842 o_conv = NodeInfo_clone(&o_conv);
20843 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20844 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
20845 return (int64_t)ret_conv;
20848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20849 LDKDecodeError e_conv;
20850 e_conv.inner = (void*)(e & (~1));
20851 e_conv.is_owned = (e & 1) || (e == 0);
20852 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20853 e_conv = DecodeError_clone(&e_conv);
20854 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20855 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
20856 return (int64_t)ret_conv;
20859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20860 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
20861 jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
20865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20866 if ((_res & 1) != 0) return;
20867 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20868 CHECK_ACCESS(_res_ptr);
20869 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
20871 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
20874 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
20875 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20876 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
20877 return (int64_t)ret_conv;
20879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20880 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
20881 int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
20885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20886 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
20887 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20888 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
20889 return (int64_t)ret_conv;
20892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20893 LDKNetworkGraph o_conv;
20894 o_conv.inner = (void*)(o & (~1));
20895 o_conv.is_owned = (o & 1) || (o == 0);
20896 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20897 o_conv = NetworkGraph_clone(&o_conv);
20898 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20899 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
20900 return (int64_t)ret_conv;
20903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20904 LDKDecodeError e_conv;
20905 e_conv.inner = (void*)(e & (~1));
20906 e_conv.is_owned = (e & 1) || (e == 0);
20907 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20908 e_conv = DecodeError_clone(&e_conv);
20909 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20910 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
20911 return (int64_t)ret_conv;
20914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20915 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
20916 jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
20920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20921 if ((_res & 1) != 0) return;
20922 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20923 CHECK_ACCESS(_res_ptr);
20924 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
20926 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
20929 static inline uintptr_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
20930 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20931 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
20932 return (int64_t)ret_conv;
20934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20935 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
20936 int64_t ret_conv = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
20940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20941 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
20942 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20943 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
20944 return (int64_t)ret_conv;
20947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
20948 LDKCVec_NetAddressZ o_constr;
20949 o_constr.datalen = (*env)->GetArrayLength(env, o);
20950 if (o_constr.datalen > 0)
20951 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20953 o_constr.data = NULL;
20954 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
20955 for (size_t m = 0; m < o_constr.datalen; m++) {
20956 int64_t o_conv_12 = o_vals[m];
20957 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
20958 CHECK_ACCESS(o_conv_12_ptr);
20959 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
20960 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
20961 o_constr.data[m] = o_conv_12_conv;
20963 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
20964 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20965 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
20966 int64_t ret_ref = (uintptr_t)ret_copy;
20970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
20971 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20972 *ret_copy = COption_CVec_NetAddressZZ_none();
20973 int64_t ret_ref = (uintptr_t)ret_copy;
20977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20978 if ((_res & 1) != 0) return;
20979 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20980 CHECK_ACCESS(_res_ptr);
20981 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
20983 COption_CVec_NetAddressZZ_free(_res_conv);
20986 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
20987 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20988 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
20989 int64_t ret_ref = (uintptr_t)ret_copy;
20992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20993 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
20994 int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
20998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20999 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
21000 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
21001 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
21002 int64_t ret_ref = (uintptr_t)ret_copy;
21006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21007 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
21008 CHECK_ACCESS(o_ptr);
21009 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
21010 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
21011 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21012 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
21013 return (int64_t)ret_conv;
21016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21017 LDKDecodeError e_conv;
21018 e_conv.inner = (void*)(e & (~1));
21019 e_conv.is_owned = (e & 1) || (e == 0);
21020 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21021 e_conv = DecodeError_clone(&e_conv);
21022 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21023 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
21024 return (int64_t)ret_conv;
21027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21028 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
21029 jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
21033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21034 if ((_res & 1) != 0) return;
21035 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21036 CHECK_ACCESS(_res_ptr);
21037 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
21039 CResult_NetAddressDecodeErrorZ_free(_res_conv);
21042 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
21043 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21044 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
21045 return (int64_t)ret_conv;
21047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21048 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
21049 int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
21053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21054 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
21055 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21056 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
21057 return (int64_t)ret_conv;
21060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21061 LDKCVec_UpdateAddHTLCZ _res_constr;
21062 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21063 if (_res_constr.datalen > 0)
21064 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21066 _res_constr.data = NULL;
21067 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21068 for (size_t p = 0; p < _res_constr.datalen; p++) {
21069 int64_t _res_conv_15 = _res_vals[p];
21070 LDKUpdateAddHTLC _res_conv_15_conv;
21071 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
21072 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
21073 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
21074 _res_constr.data[p] = _res_conv_15_conv;
21076 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21077 CVec_UpdateAddHTLCZ_free(_res_constr);
21080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21081 LDKCVec_UpdateFulfillHTLCZ _res_constr;
21082 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21083 if (_res_constr.datalen > 0)
21084 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21086 _res_constr.data = NULL;
21087 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21088 for (size_t t = 0; t < _res_constr.datalen; t++) {
21089 int64_t _res_conv_19 = _res_vals[t];
21090 LDKUpdateFulfillHTLC _res_conv_19_conv;
21091 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
21092 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
21093 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
21094 _res_constr.data[t] = _res_conv_19_conv;
21096 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21097 CVec_UpdateFulfillHTLCZ_free(_res_constr);
21100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21101 LDKCVec_UpdateFailHTLCZ _res_constr;
21102 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21103 if (_res_constr.datalen > 0)
21104 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21106 _res_constr.data = NULL;
21107 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21108 for (size_t q = 0; q < _res_constr.datalen; q++) {
21109 int64_t _res_conv_16 = _res_vals[q];
21110 LDKUpdateFailHTLC _res_conv_16_conv;
21111 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
21112 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
21113 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21114 _res_constr.data[q] = _res_conv_16_conv;
21116 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21117 CVec_UpdateFailHTLCZ_free(_res_constr);
21120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
21121 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
21122 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
21123 if (_res_constr.datalen > 0)
21124 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21126 _res_constr.data = NULL;
21127 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
21128 for (size_t z = 0; z < _res_constr.datalen; z++) {
21129 int64_t _res_conv_25 = _res_vals[z];
21130 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
21131 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
21132 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
21133 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
21134 _res_constr.data[z] = _res_conv_25_conv;
21136 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
21137 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
21140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21141 LDKAcceptChannel o_conv;
21142 o_conv.inner = (void*)(o & (~1));
21143 o_conv.is_owned = (o & 1) || (o == 0);
21144 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21145 o_conv = AcceptChannel_clone(&o_conv);
21146 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21147 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
21148 return (int64_t)ret_conv;
21151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21152 LDKDecodeError e_conv;
21153 e_conv.inner = (void*)(e & (~1));
21154 e_conv.is_owned = (e & 1) || (e == 0);
21155 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21156 e_conv = DecodeError_clone(&e_conv);
21157 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21158 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
21159 return (int64_t)ret_conv;
21162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21163 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
21164 jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
21168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21169 if ((_res & 1) != 0) return;
21170 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21171 CHECK_ACCESS(_res_ptr);
21172 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
21174 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
21177 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
21178 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21179 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
21180 return (int64_t)ret_conv;
21182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21183 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
21184 int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
21188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21189 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
21190 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21191 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
21192 return (int64_t)ret_conv;
21195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21196 LDKAnnouncementSignatures o_conv;
21197 o_conv.inner = (void*)(o & (~1));
21198 o_conv.is_owned = (o & 1) || (o == 0);
21199 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21200 o_conv = AnnouncementSignatures_clone(&o_conv);
21201 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21202 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
21203 return (int64_t)ret_conv;
21206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21207 LDKDecodeError e_conv;
21208 e_conv.inner = (void*)(e & (~1));
21209 e_conv.is_owned = (e & 1) || (e == 0);
21210 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21211 e_conv = DecodeError_clone(&e_conv);
21212 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21213 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
21214 return (int64_t)ret_conv;
21217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21218 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
21219 jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
21223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21224 if ((_res & 1) != 0) return;
21225 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21226 CHECK_ACCESS(_res_ptr);
21227 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
21229 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
21232 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
21233 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21234 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
21235 return (int64_t)ret_conv;
21237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21238 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
21239 int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
21243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21244 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
21245 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21246 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
21247 return (int64_t)ret_conv;
21250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21251 LDKChannelReestablish o_conv;
21252 o_conv.inner = (void*)(o & (~1));
21253 o_conv.is_owned = (o & 1) || (o == 0);
21254 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21255 o_conv = ChannelReestablish_clone(&o_conv);
21256 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21257 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
21258 return (int64_t)ret_conv;
21261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21262 LDKDecodeError e_conv;
21263 e_conv.inner = (void*)(e & (~1));
21264 e_conv.is_owned = (e & 1) || (e == 0);
21265 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21266 e_conv = DecodeError_clone(&e_conv);
21267 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21268 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
21269 return (int64_t)ret_conv;
21272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21273 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
21274 jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
21278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21279 if ((_res & 1) != 0) return;
21280 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21281 CHECK_ACCESS(_res_ptr);
21282 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
21284 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
21287 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
21288 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21289 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
21290 return (int64_t)ret_conv;
21292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21293 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
21294 int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
21298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21299 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
21300 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21301 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
21302 return (int64_t)ret_conv;
21305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21306 LDKClosingSigned o_conv;
21307 o_conv.inner = (void*)(o & (~1));
21308 o_conv.is_owned = (o & 1) || (o == 0);
21309 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21310 o_conv = ClosingSigned_clone(&o_conv);
21311 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21312 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
21313 return (int64_t)ret_conv;
21316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21317 LDKDecodeError e_conv;
21318 e_conv.inner = (void*)(e & (~1));
21319 e_conv.is_owned = (e & 1) || (e == 0);
21320 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21321 e_conv = DecodeError_clone(&e_conv);
21322 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21323 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
21324 return (int64_t)ret_conv;
21327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21328 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
21329 jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
21333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21334 if ((_res & 1) != 0) return;
21335 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21336 CHECK_ACCESS(_res_ptr);
21337 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
21339 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
21342 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
21343 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21344 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
21345 return (int64_t)ret_conv;
21347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21348 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
21349 int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
21353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21354 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
21355 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21356 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
21357 return (int64_t)ret_conv;
21360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21361 LDKClosingSignedFeeRange o_conv;
21362 o_conv.inner = (void*)(o & (~1));
21363 o_conv.is_owned = (o & 1) || (o == 0);
21364 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21365 o_conv = ClosingSignedFeeRange_clone(&o_conv);
21366 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21367 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
21368 return (int64_t)ret_conv;
21371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21372 LDKDecodeError e_conv;
21373 e_conv.inner = (void*)(e & (~1));
21374 e_conv.is_owned = (e & 1) || (e == 0);
21375 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21376 e_conv = DecodeError_clone(&e_conv);
21377 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21378 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
21379 return (int64_t)ret_conv;
21382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21383 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
21384 jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
21388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21389 if ((_res & 1) != 0) return;
21390 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21391 CHECK_ACCESS(_res_ptr);
21392 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
21394 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
21397 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
21398 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21399 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
21400 return (int64_t)ret_conv;
21402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21403 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
21404 int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
21408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21409 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
21410 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21411 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
21412 return (int64_t)ret_conv;
21415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21416 LDKCommitmentSigned o_conv;
21417 o_conv.inner = (void*)(o & (~1));
21418 o_conv.is_owned = (o & 1) || (o == 0);
21419 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21420 o_conv = CommitmentSigned_clone(&o_conv);
21421 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21422 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
21423 return (int64_t)ret_conv;
21426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21427 LDKDecodeError e_conv;
21428 e_conv.inner = (void*)(e & (~1));
21429 e_conv.is_owned = (e & 1) || (e == 0);
21430 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21431 e_conv = DecodeError_clone(&e_conv);
21432 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21433 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
21434 return (int64_t)ret_conv;
21437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21438 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
21439 jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
21443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21444 if ((_res & 1) != 0) return;
21445 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21446 CHECK_ACCESS(_res_ptr);
21447 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
21449 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
21452 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
21453 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21454 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
21455 return (int64_t)ret_conv;
21457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21458 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
21459 int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
21463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21464 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
21465 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21466 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
21467 return (int64_t)ret_conv;
21470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21471 LDKFundingCreated o_conv;
21472 o_conv.inner = (void*)(o & (~1));
21473 o_conv.is_owned = (o & 1) || (o == 0);
21474 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21475 o_conv = FundingCreated_clone(&o_conv);
21476 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21477 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
21478 return (int64_t)ret_conv;
21481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21482 LDKDecodeError e_conv;
21483 e_conv.inner = (void*)(e & (~1));
21484 e_conv.is_owned = (e & 1) || (e == 0);
21485 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21486 e_conv = DecodeError_clone(&e_conv);
21487 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21488 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
21489 return (int64_t)ret_conv;
21492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21493 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
21494 jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
21498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21499 if ((_res & 1) != 0) return;
21500 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21501 CHECK_ACCESS(_res_ptr);
21502 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
21504 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
21507 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
21508 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21509 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
21510 return (int64_t)ret_conv;
21512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21513 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
21514 int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
21518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21519 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
21520 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21521 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
21522 return (int64_t)ret_conv;
21525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21526 LDKFundingSigned o_conv;
21527 o_conv.inner = (void*)(o & (~1));
21528 o_conv.is_owned = (o & 1) || (o == 0);
21529 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21530 o_conv = FundingSigned_clone(&o_conv);
21531 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21532 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
21533 return (int64_t)ret_conv;
21536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21537 LDKDecodeError e_conv;
21538 e_conv.inner = (void*)(e & (~1));
21539 e_conv.is_owned = (e & 1) || (e == 0);
21540 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21541 e_conv = DecodeError_clone(&e_conv);
21542 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21543 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
21544 return (int64_t)ret_conv;
21547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21548 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
21549 jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
21553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21554 if ((_res & 1) != 0) return;
21555 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21556 CHECK_ACCESS(_res_ptr);
21557 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
21559 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
21562 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
21563 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21564 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
21565 return (int64_t)ret_conv;
21567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21568 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
21569 int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
21573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21574 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
21575 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21576 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
21577 return (int64_t)ret_conv;
21580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21581 LDKFundingLocked o_conv;
21582 o_conv.inner = (void*)(o & (~1));
21583 o_conv.is_owned = (o & 1) || (o == 0);
21584 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21585 o_conv = FundingLocked_clone(&o_conv);
21586 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21587 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
21588 return (int64_t)ret_conv;
21591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21592 LDKDecodeError e_conv;
21593 e_conv.inner = (void*)(e & (~1));
21594 e_conv.is_owned = (e & 1) || (e == 0);
21595 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21596 e_conv = DecodeError_clone(&e_conv);
21597 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21598 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
21599 return (int64_t)ret_conv;
21602 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21603 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
21604 jboolean ret_conv = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
21608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21609 if ((_res & 1) != 0) return;
21610 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21611 CHECK_ACCESS(_res_ptr);
21612 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
21614 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
21617 static inline uintptr_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
21618 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21619 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
21620 return (int64_t)ret_conv;
21622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21623 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
21624 int64_t ret_conv = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
21628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21629 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
21630 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21631 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
21632 return (int64_t)ret_conv;
21635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21637 o_conv.inner = (void*)(o & (~1));
21638 o_conv.is_owned = (o & 1) || (o == 0);
21639 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21640 o_conv = Init_clone(&o_conv);
21641 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21642 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
21643 return (int64_t)ret_conv;
21646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21647 LDKDecodeError e_conv;
21648 e_conv.inner = (void*)(e & (~1));
21649 e_conv.is_owned = (e & 1) || (e == 0);
21650 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21651 e_conv = DecodeError_clone(&e_conv);
21652 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21653 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
21654 return (int64_t)ret_conv;
21657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21658 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
21659 jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
21663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21664 if ((_res & 1) != 0) return;
21665 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21666 CHECK_ACCESS(_res_ptr);
21667 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
21669 CResult_InitDecodeErrorZ_free(_res_conv);
21672 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
21673 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21674 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
21675 return (int64_t)ret_conv;
21677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21678 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
21679 int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
21683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21684 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
21685 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21686 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
21687 return (int64_t)ret_conv;
21690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21691 LDKOpenChannel o_conv;
21692 o_conv.inner = (void*)(o & (~1));
21693 o_conv.is_owned = (o & 1) || (o == 0);
21694 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21695 o_conv = OpenChannel_clone(&o_conv);
21696 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21697 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
21698 return (int64_t)ret_conv;
21701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21702 LDKDecodeError e_conv;
21703 e_conv.inner = (void*)(e & (~1));
21704 e_conv.is_owned = (e & 1) || (e == 0);
21705 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21706 e_conv = DecodeError_clone(&e_conv);
21707 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21708 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
21709 return (int64_t)ret_conv;
21712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21713 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
21714 jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
21718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21719 if ((_res & 1) != 0) return;
21720 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21721 CHECK_ACCESS(_res_ptr);
21722 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
21724 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
21727 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
21728 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21729 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
21730 return (int64_t)ret_conv;
21732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21733 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
21734 int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
21738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21739 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
21740 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21741 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
21742 return (int64_t)ret_conv;
21745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21746 LDKRevokeAndACK o_conv;
21747 o_conv.inner = (void*)(o & (~1));
21748 o_conv.is_owned = (o & 1) || (o == 0);
21749 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21750 o_conv = RevokeAndACK_clone(&o_conv);
21751 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21752 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
21753 return (int64_t)ret_conv;
21756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21757 LDKDecodeError e_conv;
21758 e_conv.inner = (void*)(e & (~1));
21759 e_conv.is_owned = (e & 1) || (e == 0);
21760 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21761 e_conv = DecodeError_clone(&e_conv);
21762 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21763 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
21764 return (int64_t)ret_conv;
21767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21768 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
21769 jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
21773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21774 if ((_res & 1) != 0) return;
21775 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21776 CHECK_ACCESS(_res_ptr);
21777 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
21779 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
21782 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
21783 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21784 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
21785 return (int64_t)ret_conv;
21787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21788 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
21789 int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
21793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21794 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
21795 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21796 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
21797 return (int64_t)ret_conv;
21800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21801 LDKShutdown o_conv;
21802 o_conv.inner = (void*)(o & (~1));
21803 o_conv.is_owned = (o & 1) || (o == 0);
21804 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21805 o_conv = Shutdown_clone(&o_conv);
21806 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21807 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
21808 return (int64_t)ret_conv;
21811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21812 LDKDecodeError e_conv;
21813 e_conv.inner = (void*)(e & (~1));
21814 e_conv.is_owned = (e & 1) || (e == 0);
21815 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21816 e_conv = DecodeError_clone(&e_conv);
21817 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21818 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
21819 return (int64_t)ret_conv;
21822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21823 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
21824 jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
21828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21829 if ((_res & 1) != 0) return;
21830 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21831 CHECK_ACCESS(_res_ptr);
21832 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
21834 CResult_ShutdownDecodeErrorZ_free(_res_conv);
21837 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
21838 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21839 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
21840 return (int64_t)ret_conv;
21842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21843 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
21844 int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
21848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21849 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
21850 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21851 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
21852 return (int64_t)ret_conv;
21855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21856 LDKUpdateFailHTLC o_conv;
21857 o_conv.inner = (void*)(o & (~1));
21858 o_conv.is_owned = (o & 1) || (o == 0);
21859 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21860 o_conv = UpdateFailHTLC_clone(&o_conv);
21861 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21862 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
21863 return (int64_t)ret_conv;
21866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21867 LDKDecodeError e_conv;
21868 e_conv.inner = (void*)(e & (~1));
21869 e_conv.is_owned = (e & 1) || (e == 0);
21870 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21871 e_conv = DecodeError_clone(&e_conv);
21872 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21873 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
21874 return (int64_t)ret_conv;
21877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21878 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
21879 jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
21883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21884 if ((_res & 1) != 0) return;
21885 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21886 CHECK_ACCESS(_res_ptr);
21887 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
21889 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
21892 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
21893 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21894 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
21895 return (int64_t)ret_conv;
21897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21898 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
21899 int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
21903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21904 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
21905 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21906 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
21907 return (int64_t)ret_conv;
21910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21911 LDKUpdateFailMalformedHTLC o_conv;
21912 o_conv.inner = (void*)(o & (~1));
21913 o_conv.is_owned = (o & 1) || (o == 0);
21914 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21915 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
21916 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21917 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
21918 return (int64_t)ret_conv;
21921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21922 LDKDecodeError e_conv;
21923 e_conv.inner = (void*)(e & (~1));
21924 e_conv.is_owned = (e & 1) || (e == 0);
21925 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21926 e_conv = DecodeError_clone(&e_conv);
21927 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21928 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
21929 return (int64_t)ret_conv;
21932 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21933 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
21934 jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
21938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21939 if ((_res & 1) != 0) return;
21940 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21941 CHECK_ACCESS(_res_ptr);
21942 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
21944 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
21947 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
21948 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21949 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
21950 return (int64_t)ret_conv;
21952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21953 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
21954 int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
21958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21959 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
21960 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21961 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
21962 return (int64_t)ret_conv;
21965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21966 LDKUpdateFee o_conv;
21967 o_conv.inner = (void*)(o & (~1));
21968 o_conv.is_owned = (o & 1) || (o == 0);
21969 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21970 o_conv = UpdateFee_clone(&o_conv);
21971 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21972 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
21973 return (int64_t)ret_conv;
21976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21977 LDKDecodeError e_conv;
21978 e_conv.inner = (void*)(e & (~1));
21979 e_conv.is_owned = (e & 1) || (e == 0);
21980 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21981 e_conv = DecodeError_clone(&e_conv);
21982 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21983 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
21984 return (int64_t)ret_conv;
21987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21988 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
21989 jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
21993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21994 if ((_res & 1) != 0) return;
21995 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21996 CHECK_ACCESS(_res_ptr);
21997 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
21999 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
22002 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
22003 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22004 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
22005 return (int64_t)ret_conv;
22007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22008 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
22009 int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
22013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22014 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
22015 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
22016 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
22017 return (int64_t)ret_conv;
22020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22021 LDKUpdateFulfillHTLC o_conv;
22022 o_conv.inner = (void*)(o & (~1));
22023 o_conv.is_owned = (o & 1) || (o == 0);
22024 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22025 o_conv = UpdateFulfillHTLC_clone(&o_conv);
22026 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22027 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
22028 return (int64_t)ret_conv;
22031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22032 LDKDecodeError e_conv;
22033 e_conv.inner = (void*)(e & (~1));
22034 e_conv.is_owned = (e & 1) || (e == 0);
22035 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22036 e_conv = DecodeError_clone(&e_conv);
22037 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22038 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
22039 return (int64_t)ret_conv;
22042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22043 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
22044 jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
22048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22049 if ((_res & 1) != 0) return;
22050 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22051 CHECK_ACCESS(_res_ptr);
22052 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
22054 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
22057 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
22058 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22059 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
22060 return (int64_t)ret_conv;
22062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22063 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
22064 int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
22068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22069 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
22070 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22071 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
22072 return (int64_t)ret_conv;
22075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22076 LDKUpdateAddHTLC o_conv;
22077 o_conv.inner = (void*)(o & (~1));
22078 o_conv.is_owned = (o & 1) || (o == 0);
22079 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22080 o_conv = UpdateAddHTLC_clone(&o_conv);
22081 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22082 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
22083 return (int64_t)ret_conv;
22086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22087 LDKDecodeError e_conv;
22088 e_conv.inner = (void*)(e & (~1));
22089 e_conv.is_owned = (e & 1) || (e == 0);
22090 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22091 e_conv = DecodeError_clone(&e_conv);
22092 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22093 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
22094 return (int64_t)ret_conv;
22097 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22098 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
22099 jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
22103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22104 if ((_res & 1) != 0) return;
22105 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22106 CHECK_ACCESS(_res_ptr);
22107 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
22109 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
22112 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
22113 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22114 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
22115 return (int64_t)ret_conv;
22117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22118 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
22119 int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
22123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22124 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
22125 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22126 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
22127 return (int64_t)ret_conv;
22130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22132 o_conv.inner = (void*)(o & (~1));
22133 o_conv.is_owned = (o & 1) || (o == 0);
22134 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22135 o_conv = Ping_clone(&o_conv);
22136 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22137 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
22138 return (int64_t)ret_conv;
22141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22142 LDKDecodeError e_conv;
22143 e_conv.inner = (void*)(e & (~1));
22144 e_conv.is_owned = (e & 1) || (e == 0);
22145 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22146 e_conv = DecodeError_clone(&e_conv);
22147 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22148 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
22149 return (int64_t)ret_conv;
22152 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22153 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
22154 jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
22158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22159 if ((_res & 1) != 0) return;
22160 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22161 CHECK_ACCESS(_res_ptr);
22162 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
22164 CResult_PingDecodeErrorZ_free(_res_conv);
22167 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
22168 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22169 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
22170 return (int64_t)ret_conv;
22172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22173 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
22174 int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
22178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22179 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
22180 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22181 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
22182 return (int64_t)ret_conv;
22185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22187 o_conv.inner = (void*)(o & (~1));
22188 o_conv.is_owned = (o & 1) || (o == 0);
22189 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22190 o_conv = Pong_clone(&o_conv);
22191 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22192 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
22193 return (int64_t)ret_conv;
22196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22197 LDKDecodeError e_conv;
22198 e_conv.inner = (void*)(e & (~1));
22199 e_conv.is_owned = (e & 1) || (e == 0);
22200 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22201 e_conv = DecodeError_clone(&e_conv);
22202 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22203 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
22204 return (int64_t)ret_conv;
22207 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22208 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
22209 jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
22213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22214 if ((_res & 1) != 0) return;
22215 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22216 CHECK_ACCESS(_res_ptr);
22217 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
22219 CResult_PongDecodeErrorZ_free(_res_conv);
22222 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
22223 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22224 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
22225 return (int64_t)ret_conv;
22227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22228 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
22229 int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
22233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22234 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
22235 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22236 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
22237 return (int64_t)ret_conv;
22240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22241 LDKUnsignedChannelAnnouncement o_conv;
22242 o_conv.inner = (void*)(o & (~1));
22243 o_conv.is_owned = (o & 1) || (o == 0);
22244 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22245 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
22246 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22247 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
22248 return (int64_t)ret_conv;
22251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22252 LDKDecodeError e_conv;
22253 e_conv.inner = (void*)(e & (~1));
22254 e_conv.is_owned = (e & 1) || (e == 0);
22255 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22256 e_conv = DecodeError_clone(&e_conv);
22257 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22258 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
22259 return (int64_t)ret_conv;
22262 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22263 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
22264 jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22269 if ((_res & 1) != 0) return;
22270 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22271 CHECK_ACCESS(_res_ptr);
22272 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22274 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
22277 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22278 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22279 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
22280 return (int64_t)ret_conv;
22282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22283 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
22284 int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22289 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
22290 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22291 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22292 return (int64_t)ret_conv;
22295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22296 LDKChannelAnnouncement o_conv;
22297 o_conv.inner = (void*)(o & (~1));
22298 o_conv.is_owned = (o & 1) || (o == 0);
22299 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22300 o_conv = ChannelAnnouncement_clone(&o_conv);
22301 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22302 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
22303 return (int64_t)ret_conv;
22306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22307 LDKDecodeError e_conv;
22308 e_conv.inner = (void*)(e & (~1));
22309 e_conv.is_owned = (e & 1) || (e == 0);
22310 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22311 e_conv = DecodeError_clone(&e_conv);
22312 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22313 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
22314 return (int64_t)ret_conv;
22317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22318 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
22319 jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
22323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22324 if ((_res & 1) != 0) return;
22325 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22326 CHECK_ACCESS(_res_ptr);
22327 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
22329 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
22332 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22333 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22334 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
22335 return (int64_t)ret_conv;
22337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22338 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
22339 int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22344 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
22345 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22346 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
22347 return (int64_t)ret_conv;
22350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22351 LDKUnsignedChannelUpdate o_conv;
22352 o_conv.inner = (void*)(o & (~1));
22353 o_conv.is_owned = (o & 1) || (o == 0);
22354 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22355 o_conv = UnsignedChannelUpdate_clone(&o_conv);
22356 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22357 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
22358 return (int64_t)ret_conv;
22361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22362 LDKDecodeError e_conv;
22363 e_conv.inner = (void*)(e & (~1));
22364 e_conv.is_owned = (e & 1) || (e == 0);
22365 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22366 e_conv = DecodeError_clone(&e_conv);
22367 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22368 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
22369 return (int64_t)ret_conv;
22372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22373 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
22374 jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
22378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22379 if ((_res & 1) != 0) return;
22380 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22381 CHECK_ACCESS(_res_ptr);
22382 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
22384 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
22387 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22388 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22389 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
22390 return (int64_t)ret_conv;
22392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22393 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
22394 int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22399 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
22400 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22401 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
22402 return (int64_t)ret_conv;
22405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22406 LDKChannelUpdate o_conv;
22407 o_conv.inner = (void*)(o & (~1));
22408 o_conv.is_owned = (o & 1) || (o == 0);
22409 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22410 o_conv = ChannelUpdate_clone(&o_conv);
22411 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22412 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
22413 return (int64_t)ret_conv;
22416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22417 LDKDecodeError e_conv;
22418 e_conv.inner = (void*)(e & (~1));
22419 e_conv.is_owned = (e & 1) || (e == 0);
22420 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22421 e_conv = DecodeError_clone(&e_conv);
22422 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22423 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
22424 return (int64_t)ret_conv;
22427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22428 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
22429 jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
22433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22434 if ((_res & 1) != 0) return;
22435 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22436 CHECK_ACCESS(_res_ptr);
22437 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
22439 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
22442 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22443 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22444 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
22445 return (int64_t)ret_conv;
22447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22448 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
22449 int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22454 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
22455 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22456 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
22457 return (int64_t)ret_conv;
22460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22461 LDKErrorMessage o_conv;
22462 o_conv.inner = (void*)(o & (~1));
22463 o_conv.is_owned = (o & 1) || (o == 0);
22464 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22465 o_conv = ErrorMessage_clone(&o_conv);
22466 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22467 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
22468 return (int64_t)ret_conv;
22471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22472 LDKDecodeError e_conv;
22473 e_conv.inner = (void*)(e & (~1));
22474 e_conv.is_owned = (e & 1) || (e == 0);
22475 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22476 e_conv = DecodeError_clone(&e_conv);
22477 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22478 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
22479 return (int64_t)ret_conv;
22482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22483 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
22484 jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
22488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22489 if ((_res & 1) != 0) return;
22490 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22491 CHECK_ACCESS(_res_ptr);
22492 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
22494 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
22497 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
22498 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22499 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
22500 return (int64_t)ret_conv;
22502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22503 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
22504 int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
22508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22509 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
22510 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22511 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
22512 return (int64_t)ret_conv;
22515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22516 LDKWarningMessage o_conv;
22517 o_conv.inner = (void*)(o & (~1));
22518 o_conv.is_owned = (o & 1) || (o == 0);
22519 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22520 o_conv = WarningMessage_clone(&o_conv);
22521 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22522 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
22523 return (int64_t)ret_conv;
22526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22527 LDKDecodeError e_conv;
22528 e_conv.inner = (void*)(e & (~1));
22529 e_conv.is_owned = (e & 1) || (e == 0);
22530 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22531 e_conv = DecodeError_clone(&e_conv);
22532 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22533 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
22534 return (int64_t)ret_conv;
22537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22538 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
22539 jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
22543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22544 if ((_res & 1) != 0) return;
22545 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22546 CHECK_ACCESS(_res_ptr);
22547 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
22549 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
22552 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
22553 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22554 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
22555 return (int64_t)ret_conv;
22557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22558 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
22559 int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
22563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22564 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
22565 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22566 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
22567 return (int64_t)ret_conv;
22570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22571 LDKUnsignedNodeAnnouncement o_conv;
22572 o_conv.inner = (void*)(o & (~1));
22573 o_conv.is_owned = (o & 1) || (o == 0);
22574 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22575 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
22576 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22577 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
22578 return (int64_t)ret_conv;
22581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22582 LDKDecodeError e_conv;
22583 e_conv.inner = (void*)(e & (~1));
22584 e_conv.is_owned = (e & 1) || (e == 0);
22585 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22586 e_conv = DecodeError_clone(&e_conv);
22587 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22588 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
22589 return (int64_t)ret_conv;
22592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22593 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
22594 jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22599 if ((_res & 1) != 0) return;
22600 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22601 CHECK_ACCESS(_res_ptr);
22602 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
22604 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
22607 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22608 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22609 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
22610 return (int64_t)ret_conv;
22612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22613 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
22614 int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22619 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
22620 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22621 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
22622 return (int64_t)ret_conv;
22625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22626 LDKNodeAnnouncement o_conv;
22627 o_conv.inner = (void*)(o & (~1));
22628 o_conv.is_owned = (o & 1) || (o == 0);
22629 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22630 o_conv = NodeAnnouncement_clone(&o_conv);
22631 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22632 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
22633 return (int64_t)ret_conv;
22636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22637 LDKDecodeError e_conv;
22638 e_conv.inner = (void*)(e & (~1));
22639 e_conv.is_owned = (e & 1) || (e == 0);
22640 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22641 e_conv = DecodeError_clone(&e_conv);
22642 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22643 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
22644 return (int64_t)ret_conv;
22647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22648 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
22649 jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22654 if ((_res & 1) != 0) return;
22655 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22656 CHECK_ACCESS(_res_ptr);
22657 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
22659 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
22662 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22663 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22664 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
22665 return (int64_t)ret_conv;
22667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22668 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
22669 int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22674 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
22675 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22676 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
22677 return (int64_t)ret_conv;
22680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22681 LDKQueryShortChannelIds o_conv;
22682 o_conv.inner = (void*)(o & (~1));
22683 o_conv.is_owned = (o & 1) || (o == 0);
22684 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22685 o_conv = QueryShortChannelIds_clone(&o_conv);
22686 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22687 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
22688 return (int64_t)ret_conv;
22691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22692 LDKDecodeError e_conv;
22693 e_conv.inner = (void*)(e & (~1));
22694 e_conv.is_owned = (e & 1) || (e == 0);
22695 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22696 e_conv = DecodeError_clone(&e_conv);
22697 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22698 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
22699 return (int64_t)ret_conv;
22702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22703 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
22704 jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
22708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22709 if ((_res & 1) != 0) return;
22710 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22711 CHECK_ACCESS(_res_ptr);
22712 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
22714 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
22717 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
22718 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22719 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
22720 return (int64_t)ret_conv;
22722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22723 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
22724 int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
22728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22729 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
22730 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22731 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
22732 return (int64_t)ret_conv;
22735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22736 LDKReplyShortChannelIdsEnd o_conv;
22737 o_conv.inner = (void*)(o & (~1));
22738 o_conv.is_owned = (o & 1) || (o == 0);
22739 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22740 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
22741 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22742 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
22743 return (int64_t)ret_conv;
22746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22747 LDKDecodeError e_conv;
22748 e_conv.inner = (void*)(e & (~1));
22749 e_conv.is_owned = (e & 1) || (e == 0);
22750 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22751 e_conv = DecodeError_clone(&e_conv);
22752 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22753 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
22754 return (int64_t)ret_conv;
22757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22758 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
22759 jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
22763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22764 if ((_res & 1) != 0) return;
22765 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22766 CHECK_ACCESS(_res_ptr);
22767 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
22769 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
22772 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
22773 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22774 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
22775 return (int64_t)ret_conv;
22777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22778 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
22779 int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
22783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22784 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
22785 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22786 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
22787 return (int64_t)ret_conv;
22790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22791 LDKQueryChannelRange o_conv;
22792 o_conv.inner = (void*)(o & (~1));
22793 o_conv.is_owned = (o & 1) || (o == 0);
22794 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22795 o_conv = QueryChannelRange_clone(&o_conv);
22796 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22797 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
22798 return (int64_t)ret_conv;
22801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22802 LDKDecodeError e_conv;
22803 e_conv.inner = (void*)(e & (~1));
22804 e_conv.is_owned = (e & 1) || (e == 0);
22805 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22806 e_conv = DecodeError_clone(&e_conv);
22807 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22808 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
22809 return (int64_t)ret_conv;
22812 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22813 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
22814 jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
22818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22819 if ((_res & 1) != 0) return;
22820 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22821 CHECK_ACCESS(_res_ptr);
22822 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
22824 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
22827 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22828 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22829 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
22830 return (int64_t)ret_conv;
22832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22833 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
22834 int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22839 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
22840 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22841 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
22842 return (int64_t)ret_conv;
22845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22846 LDKReplyChannelRange o_conv;
22847 o_conv.inner = (void*)(o & (~1));
22848 o_conv.is_owned = (o & 1) || (o == 0);
22849 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22850 o_conv = ReplyChannelRange_clone(&o_conv);
22851 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22852 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
22853 return (int64_t)ret_conv;
22856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22857 LDKDecodeError e_conv;
22858 e_conv.inner = (void*)(e & (~1));
22859 e_conv.is_owned = (e & 1) || (e == 0);
22860 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22861 e_conv = DecodeError_clone(&e_conv);
22862 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22863 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
22864 return (int64_t)ret_conv;
22867 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22868 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
22869 jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
22873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22874 if ((_res & 1) != 0) return;
22875 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22876 CHECK_ACCESS(_res_ptr);
22877 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
22879 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
22882 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22883 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22884 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
22885 return (int64_t)ret_conv;
22887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22888 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
22889 int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22894 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
22895 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22896 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
22897 return (int64_t)ret_conv;
22900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22901 LDKGossipTimestampFilter o_conv;
22902 o_conv.inner = (void*)(o & (~1));
22903 o_conv.is_owned = (o & 1) || (o == 0);
22904 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22905 o_conv = GossipTimestampFilter_clone(&o_conv);
22906 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22907 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
22908 return (int64_t)ret_conv;
22911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22912 LDKDecodeError e_conv;
22913 e_conv.inner = (void*)(e & (~1));
22914 e_conv.is_owned = (e & 1) || (e == 0);
22915 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22916 e_conv = DecodeError_clone(&e_conv);
22917 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22918 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
22919 return (int64_t)ret_conv;
22922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22923 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
22924 jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
22928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22929 if ((_res & 1) != 0) return;
22930 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22931 CHECK_ACCESS(_res_ptr);
22932 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
22934 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
22937 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
22938 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22939 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
22940 return (int64_t)ret_conv;
22942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22943 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
22944 int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
22948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22949 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
22950 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22951 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
22952 return (int64_t)ret_conv;
22955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22956 LDKCVec_PhantomRouteHintsZ _res_constr;
22957 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22958 if (_res_constr.datalen > 0)
22959 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
22961 _res_constr.data = NULL;
22962 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22963 for (size_t t = 0; t < _res_constr.datalen; t++) {
22964 int64_t _res_conv_19 = _res_vals[t];
22965 LDKPhantomRouteHints _res_conv_19_conv;
22966 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
22967 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
22968 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22969 _res_constr.data[t] = _res_conv_19_conv;
22971 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22972 CVec_PhantomRouteHintsZ_free(_res_constr);
22975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22977 o_conv.inner = (void*)(o & (~1));
22978 o_conv.is_owned = (o & 1) || (o == 0);
22979 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22980 o_conv = Invoice_clone(&o_conv);
22981 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22982 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
22983 return (int64_t)ret_conv;
22986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22987 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
22988 CHECK_ACCESS(e_ptr);
22989 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
22990 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
22991 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22992 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
22993 return (int64_t)ret_conv;
22996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22997 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
22998 jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
23002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23003 if ((_res & 1) != 0) return;
23004 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23005 CHECK_ACCESS(_res_ptr);
23006 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
23008 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
23011 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
23012 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23013 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
23014 return (int64_t)ret_conv;
23016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23017 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
23018 int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
23022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23023 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
23024 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
23025 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
23026 return (int64_t)ret_conv;
23029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
23030 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
23031 CHECK_ACCESS(o_ptr);
23032 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
23033 if (o_conv.free == LDKFilter_JCalls_free) {
23034 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23035 LDKFilter_JCalls_cloned(&o_conv);
23037 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
23038 *ret_copy = COption_FilterZ_some(o_conv);
23039 int64_t ret_ref = (uintptr_t)ret_copy;
23043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
23044 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
23045 *ret_copy = COption_FilterZ_none();
23046 int64_t ret_ref = (uintptr_t)ret_copy;
23050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23051 if ((_res & 1) != 0) return;
23052 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23053 CHECK_ACCESS(_res_ptr);
23054 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
23056 COption_FilterZ_free(_res_conv);
23059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23060 LDKLockedChannelMonitor o_conv;
23061 o_conv.inner = (void*)(o & (~1));
23062 o_conv.is_owned = (o & 1) || (o == 0);
23063 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23064 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
23065 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23066 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
23067 return (int64_t)ret_conv;
23070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
23071 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23072 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
23073 return (int64_t)ret_conv;
23076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23077 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
23078 jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
23082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23083 if ((_res & 1) != 0) return;
23084 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
23085 CHECK_ACCESS(_res_ptr);
23086 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
23088 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
23091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
23092 LDKCVec_OutPointZ _res_constr;
23093 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
23094 if (_res_constr.datalen > 0)
23095 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
23097 _res_constr.data = NULL;
23098 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
23099 for (size_t k = 0; k < _res_constr.datalen; k++) {
23100 int64_t _res_conv_10 = _res_vals[k];
23101 LDKOutPoint _res_conv_10_conv;
23102 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
23103 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
23104 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
23105 _res_constr.data[k] = _res_conv_10_conv;
23107 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
23108 CVec_OutPointZ_free(_res_constr);
23111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23112 if ((this_ptr & 1) != 0) return;
23113 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23114 CHECK_ACCESS(this_ptr_ptr);
23115 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
23116 FREE((void*)this_ptr);
23117 PaymentPurpose_free(this_ptr_conv);
23120 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
23121 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23122 *ret_copy = PaymentPurpose_clone(arg);
23123 int64_t ret_ref = (uintptr_t)ret_copy;
23126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23127 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
23128 int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
23132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23133 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
23134 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23135 *ret_copy = PaymentPurpose_clone(orig_conv);
23136 int64_t ret_ref = (uintptr_t)ret_copy;
23140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
23141 LDKThirtyTwoBytes payment_preimage_ref;
23142 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23143 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23144 LDKThirtyTwoBytes payment_secret_ref;
23145 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
23146 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
23147 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23148 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
23149 int64_t ret_ref = (uintptr_t)ret_copy;
23153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
23154 LDKThirtyTwoBytes a_ref;
23155 CHECK((*env)->GetArrayLength(env, a) == 32);
23156 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
23157 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
23158 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
23159 int64_t ret_ref = (uintptr_t)ret_copy;
23163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23164 if ((this_ptr & 1) != 0) return;
23165 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23166 CHECK_ACCESS(this_ptr_ptr);
23167 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
23168 FREE((void*)this_ptr);
23169 ClosureReason_free(this_ptr_conv);
23172 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
23173 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23174 *ret_copy = ClosureReason_clone(arg);
23175 int64_t ret_ref = (uintptr_t)ret_copy;
23178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23179 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
23180 int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
23184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23185 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
23186 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23187 *ret_copy = ClosureReason_clone(orig_conv);
23188 int64_t ret_ref = (uintptr_t)ret_copy;
23192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
23193 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
23194 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23195 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
23196 int64_t ret_ref = (uintptr_t)ret_copy;
23200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
23201 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23202 *ret_copy = ClosureReason_holder_force_closed();
23203 int64_t ret_ref = (uintptr_t)ret_copy;
23207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
23208 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23209 *ret_copy = ClosureReason_cooperative_closure();
23210 int64_t ret_ref = (uintptr_t)ret_copy;
23214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
23215 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23216 *ret_copy = ClosureReason_commitment_tx_confirmed();
23217 int64_t ret_ref = (uintptr_t)ret_copy;
23221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
23222 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23223 *ret_copy = ClosureReason_funding_timed_out();
23224 int64_t ret_ref = (uintptr_t)ret_copy;
23228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
23229 LDKStr err_conv = java_to_owned_str(env, err);
23230 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23231 *ret_copy = ClosureReason_processing_error(err_conv);
23232 int64_t ret_ref = (uintptr_t)ret_copy;
23236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
23237 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23238 *ret_copy = ClosureReason_disconnected_peer();
23239 int64_t ret_ref = (uintptr_t)ret_copy;
23243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
23244 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
23245 *ret_copy = ClosureReason_outdated_channel_manager();
23246 int64_t ret_ref = (uintptr_t)ret_copy;
23250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
23251 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
23252 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
23253 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23254 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23255 CVec_u8Z_free(ret_var);
23259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23260 LDKu8slice ser_ref;
23261 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23262 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23263 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
23264 *ret_conv = ClosureReason_read(ser_ref);
23265 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23266 return (int64_t)ret_conv;
23269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23270 if ((this_ptr & 1) != 0) return;
23271 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23272 CHECK_ACCESS(this_ptr_ptr);
23273 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
23274 FREE((void*)this_ptr);
23275 Event_free(this_ptr_conv);
23278 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
23279 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23280 *ret_copy = Event_clone(arg);
23281 int64_t ret_ref = (uintptr_t)ret_copy;
23284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23285 LDKEvent* arg_conv = (LDKEvent*)arg;
23286 int64_t ret_conv = Event_clone_ptr(arg_conv);
23290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23291 LDKEvent* orig_conv = (LDKEvent*)orig;
23292 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23293 *ret_copy = Event_clone(orig_conv);
23294 int64_t ret_ref = (uintptr_t)ret_copy;
23298 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) {
23299 LDKThirtyTwoBytes temporary_channel_id_ref;
23300 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23301 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23302 LDKCVec_u8Z output_script_ref;
23303 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
23304 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
23305 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
23306 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23307 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
23308 int64_t ret_ref = (uintptr_t)ret_copy;
23312 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) {
23313 LDKThirtyTwoBytes payment_hash_ref;
23314 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23315 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23316 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
23317 CHECK_ACCESS(purpose_ptr);
23318 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
23319 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
23320 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23321 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
23322 int64_t ret_ref = (uintptr_t)ret_copy;
23326 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) {
23327 LDKThirtyTwoBytes payment_id_ref;
23328 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23329 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23330 LDKThirtyTwoBytes payment_preimage_ref;
23331 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
23332 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
23333 LDKThirtyTwoBytes payment_hash_ref;
23334 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23335 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23336 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
23337 CHECK_ACCESS(fee_paid_msat_ptr);
23338 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
23339 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
23340 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23341 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
23342 int64_t ret_ref = (uintptr_t)ret_copy;
23346 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) {
23347 LDKThirtyTwoBytes payment_id_ref;
23348 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23349 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23350 LDKThirtyTwoBytes payment_hash_ref;
23351 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23352 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23353 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
23354 CHECK_ACCESS(network_update_ptr);
23355 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
23356 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
23357 LDKCVec_RouteHopZ path_constr;
23358 path_constr.datalen = (*env)->GetArrayLength(env, path);
23359 if (path_constr.datalen > 0)
23360 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23362 path_constr.data = NULL;
23363 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23364 for (size_t k = 0; k < path_constr.datalen; k++) {
23365 int64_t path_conv_10 = path_vals[k];
23366 LDKRouteHop path_conv_10_conv;
23367 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
23368 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
23369 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23370 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23371 path_constr.data[k] = path_conv_10_conv;
23373 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23374 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
23375 CHECK_ACCESS(short_channel_id_ptr);
23376 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
23377 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
23378 LDKRouteParameters retry_conv;
23379 retry_conv.inner = (void*)(retry & (~1));
23380 retry_conv.is_owned = (retry & 1) || (retry == 0);
23381 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
23382 retry_conv = RouteParameters_clone(&retry_conv);
23383 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23384 *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);
23385 int64_t ret_ref = (uintptr_t)ret_copy;
23389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
23390 LDKThirtyTwoBytes payment_id_ref;
23391 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23392 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23393 LDKThirtyTwoBytes payment_hash_ref;
23394 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23395 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23396 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23397 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
23398 int64_t ret_ref = (uintptr_t)ret_copy;
23402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
23403 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23404 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
23405 int64_t ret_ref = (uintptr_t)ret_copy;
23409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
23410 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
23411 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
23412 if (outputs_constr.datalen > 0)
23413 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23415 outputs_constr.data = NULL;
23416 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
23417 for (size_t b = 0; b < outputs_constr.datalen; b++) {
23418 int64_t outputs_conv_27 = outputs_vals[b];
23419 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
23420 CHECK_ACCESS(outputs_conv_27_ptr);
23421 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
23422 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
23423 outputs_constr.data[b] = outputs_conv_27_conv;
23425 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
23426 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23427 *ret_copy = Event_spendable_outputs(outputs_constr);
23428 int64_t ret_ref = (uintptr_t)ret_copy;
23432 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) {
23433 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
23434 CHECK_ACCESS(fee_earned_msat_ptr);
23435 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
23436 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
23437 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23438 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
23439 int64_t ret_ref = (uintptr_t)ret_copy;
23443 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) {
23444 LDKThirtyTwoBytes channel_id_ref;
23445 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23446 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23447 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
23448 CHECK_ACCESS(reason_ptr);
23449 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
23450 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
23451 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23452 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
23453 int64_t ret_ref = (uintptr_t)ret_copy;
23457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
23458 LDKThirtyTwoBytes channel_id_ref;
23459 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23460 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23461 LDKTransaction transaction_ref;
23462 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
23463 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
23464 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
23465 transaction_ref.data_is_owned = true;
23466 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23467 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
23468 int64_t ret_ref = (uintptr_t)ret_copy;
23472 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) {
23473 LDKThirtyTwoBytes payment_id_ref;
23474 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23475 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23476 LDKThirtyTwoBytes payment_hash_ref;
23477 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23478 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23479 LDKCVec_RouteHopZ path_constr;
23480 path_constr.datalen = (*env)->GetArrayLength(env, path);
23481 if (path_constr.datalen > 0)
23482 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23484 path_constr.data = NULL;
23485 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23486 for (size_t k = 0; k < path_constr.datalen; k++) {
23487 int64_t path_conv_10 = path_vals[k];
23488 LDKRouteHop path_conv_10_conv;
23489 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
23490 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
23491 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23492 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23493 path_constr.data[k] = path_conv_10_conv;
23495 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23496 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23497 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
23498 int64_t ret_ref = (uintptr_t)ret_copy;
23502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
23503 LDKThirtyTwoBytes temporary_channel_id_ref;
23504 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23505 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23506 LDKPublicKey counterparty_node_id_ref;
23507 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
23508 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
23509 LDKChannelTypeFeatures channel_type_conv;
23510 channel_type_conv.inner = (void*)(channel_type & (~1));
23511 channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0);
23512 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
23513 channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
23514 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23515 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
23516 int64_t ret_ref = (uintptr_t)ret_copy;
23520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
23521 LDKEvent* obj_conv = (LDKEvent*)obj;
23522 LDKCVec_u8Z ret_var = Event_write(obj_conv);
23523 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23524 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23525 CVec_u8Z_free(ret_var);
23529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23530 LDKu8slice ser_ref;
23531 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23532 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23533 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
23534 *ret_conv = Event_read(ser_ref);
23535 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23536 return (int64_t)ret_conv;
23539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23540 if ((this_ptr & 1) != 0) return;
23541 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23542 CHECK_ACCESS(this_ptr_ptr);
23543 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
23544 FREE((void*)this_ptr);
23545 MessageSendEvent_free(this_ptr_conv);
23548 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
23549 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23550 *ret_copy = MessageSendEvent_clone(arg);
23551 int64_t ret_ref = (uintptr_t)ret_copy;
23554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23555 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
23556 int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
23560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23561 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
23562 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23563 *ret_copy = MessageSendEvent_clone(orig_conv);
23564 int64_t ret_ref = (uintptr_t)ret_copy;
23568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23569 LDKPublicKey node_id_ref;
23570 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23571 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23572 LDKAcceptChannel msg_conv;
23573 msg_conv.inner = (void*)(msg & (~1));
23574 msg_conv.is_owned = (msg & 1) || (msg == 0);
23575 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23576 msg_conv = AcceptChannel_clone(&msg_conv);
23577 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23578 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
23579 int64_t ret_ref = (uintptr_t)ret_copy;
23583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23584 LDKPublicKey node_id_ref;
23585 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23586 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23587 LDKOpenChannel msg_conv;
23588 msg_conv.inner = (void*)(msg & (~1));
23589 msg_conv.is_owned = (msg & 1) || (msg == 0);
23590 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23591 msg_conv = OpenChannel_clone(&msg_conv);
23592 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23593 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
23594 int64_t ret_ref = (uintptr_t)ret_copy;
23598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23599 LDKPublicKey node_id_ref;
23600 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23601 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23602 LDKFundingCreated msg_conv;
23603 msg_conv.inner = (void*)(msg & (~1));
23604 msg_conv.is_owned = (msg & 1) || (msg == 0);
23605 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23606 msg_conv = FundingCreated_clone(&msg_conv);
23607 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23608 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
23609 int64_t ret_ref = (uintptr_t)ret_copy;
23613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23614 LDKPublicKey node_id_ref;
23615 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23616 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23617 LDKFundingSigned msg_conv;
23618 msg_conv.inner = (void*)(msg & (~1));
23619 msg_conv.is_owned = (msg & 1) || (msg == 0);
23620 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23621 msg_conv = FundingSigned_clone(&msg_conv);
23622 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23623 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
23624 int64_t ret_ref = (uintptr_t)ret_copy;
23628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23629 LDKPublicKey node_id_ref;
23630 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23631 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23632 LDKFundingLocked msg_conv;
23633 msg_conv.inner = (void*)(msg & (~1));
23634 msg_conv.is_owned = (msg & 1) || (msg == 0);
23635 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23636 msg_conv = FundingLocked_clone(&msg_conv);
23637 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23638 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
23639 int64_t ret_ref = (uintptr_t)ret_copy;
23643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23644 LDKPublicKey node_id_ref;
23645 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23646 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23647 LDKAnnouncementSignatures msg_conv;
23648 msg_conv.inner = (void*)(msg & (~1));
23649 msg_conv.is_owned = (msg & 1) || (msg == 0);
23650 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23651 msg_conv = AnnouncementSignatures_clone(&msg_conv);
23652 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23653 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
23654 int64_t ret_ref = (uintptr_t)ret_copy;
23658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
23659 LDKPublicKey node_id_ref;
23660 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23661 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23662 LDKCommitmentUpdate updates_conv;
23663 updates_conv.inner = (void*)(updates & (~1));
23664 updates_conv.is_owned = (updates & 1) || (updates == 0);
23665 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
23666 updates_conv = CommitmentUpdate_clone(&updates_conv);
23667 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23668 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
23669 int64_t ret_ref = (uintptr_t)ret_copy;
23673 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) {
23674 LDKPublicKey node_id_ref;
23675 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23676 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23677 LDKRevokeAndACK msg_conv;
23678 msg_conv.inner = (void*)(msg & (~1));
23679 msg_conv.is_owned = (msg & 1) || (msg == 0);
23680 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23681 msg_conv = RevokeAndACK_clone(&msg_conv);
23682 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23683 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
23684 int64_t ret_ref = (uintptr_t)ret_copy;
23688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23689 LDKPublicKey node_id_ref;
23690 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23691 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23692 LDKClosingSigned msg_conv;
23693 msg_conv.inner = (void*)(msg & (~1));
23694 msg_conv.is_owned = (msg & 1) || (msg == 0);
23695 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23696 msg_conv = ClosingSigned_clone(&msg_conv);
23697 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23698 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
23699 int64_t ret_ref = (uintptr_t)ret_copy;
23703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23704 LDKPublicKey node_id_ref;
23705 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23706 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23707 LDKShutdown msg_conv;
23708 msg_conv.inner = (void*)(msg & (~1));
23709 msg_conv.is_owned = (msg & 1) || (msg == 0);
23710 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23711 msg_conv = Shutdown_clone(&msg_conv);
23712 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23713 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
23714 int64_t ret_ref = (uintptr_t)ret_copy;
23718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23719 LDKPublicKey node_id_ref;
23720 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23721 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23722 LDKChannelReestablish msg_conv;
23723 msg_conv.inner = (void*)(msg & (~1));
23724 msg_conv.is_owned = (msg & 1) || (msg == 0);
23725 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23726 msg_conv = ChannelReestablish_clone(&msg_conv);
23727 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23728 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
23729 int64_t ret_ref = (uintptr_t)ret_copy;
23733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
23734 LDKChannelAnnouncement msg_conv;
23735 msg_conv.inner = (void*)(msg & (~1));
23736 msg_conv.is_owned = (msg & 1) || (msg == 0);
23737 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23738 msg_conv = ChannelAnnouncement_clone(&msg_conv);
23739 LDKChannelUpdate update_msg_conv;
23740 update_msg_conv.inner = (void*)(update_msg & (~1));
23741 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
23742 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
23743 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
23744 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23745 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
23746 int64_t ret_ref = (uintptr_t)ret_copy;
23750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
23751 LDKNodeAnnouncement msg_conv;
23752 msg_conv.inner = (void*)(msg & (~1));
23753 msg_conv.is_owned = (msg & 1) || (msg == 0);
23754 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23755 msg_conv = NodeAnnouncement_clone(&msg_conv);
23756 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23757 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
23758 int64_t ret_ref = (uintptr_t)ret_copy;
23762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
23763 LDKChannelUpdate msg_conv;
23764 msg_conv.inner = (void*)(msg & (~1));
23765 msg_conv.is_owned = (msg & 1) || (msg == 0);
23766 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23767 msg_conv = ChannelUpdate_clone(&msg_conv);
23768 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23769 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
23770 int64_t ret_ref = (uintptr_t)ret_copy;
23774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23775 LDKPublicKey node_id_ref;
23776 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23777 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23778 LDKChannelUpdate msg_conv;
23779 msg_conv.inner = (void*)(msg & (~1));
23780 msg_conv.is_owned = (msg & 1) || (msg == 0);
23781 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23782 msg_conv = ChannelUpdate_clone(&msg_conv);
23783 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23784 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
23785 int64_t ret_ref = (uintptr_t)ret_copy;
23789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
23790 LDKPublicKey node_id_ref;
23791 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23792 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23793 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
23794 CHECK_ACCESS(action_ptr);
23795 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
23796 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
23797 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23798 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
23799 int64_t ret_ref = (uintptr_t)ret_copy;
23803 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) {
23804 LDKPublicKey node_id_ref;
23805 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23806 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23807 LDKQueryChannelRange msg_conv;
23808 msg_conv.inner = (void*)(msg & (~1));
23809 msg_conv.is_owned = (msg & 1) || (msg == 0);
23810 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23811 msg_conv = QueryChannelRange_clone(&msg_conv);
23812 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23813 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
23814 int64_t ret_ref = (uintptr_t)ret_copy;
23818 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) {
23819 LDKPublicKey node_id_ref;
23820 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23821 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23822 LDKQueryShortChannelIds msg_conv;
23823 msg_conv.inner = (void*)(msg & (~1));
23824 msg_conv.is_owned = (msg & 1) || (msg == 0);
23825 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23826 msg_conv = QueryShortChannelIds_clone(&msg_conv);
23827 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23828 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
23829 int64_t ret_ref = (uintptr_t)ret_copy;
23833 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) {
23834 LDKPublicKey node_id_ref;
23835 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23836 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23837 LDKReplyChannelRange msg_conv;
23838 msg_conv.inner = (void*)(msg & (~1));
23839 msg_conv.is_owned = (msg & 1) || (msg == 0);
23840 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23841 msg_conv = ReplyChannelRange_clone(&msg_conv);
23842 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23843 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
23844 int64_t ret_ref = (uintptr_t)ret_copy;
23848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1gossip_1timestamp_1filter(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23849 LDKPublicKey node_id_ref;
23850 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23851 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23852 LDKGossipTimestampFilter msg_conv;
23853 msg_conv.inner = (void*)(msg & (~1));
23854 msg_conv.is_owned = (msg & 1) || (msg == 0);
23855 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23856 msg_conv = GossipTimestampFilter_clone(&msg_conv);
23857 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23858 *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
23859 int64_t ret_ref = (uintptr_t)ret_copy;
23863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23864 if ((this_ptr & 1) != 0) return;
23865 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23866 CHECK_ACCESS(this_ptr_ptr);
23867 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
23868 FREE((void*)this_ptr);
23869 MessageSendEventsProvider_free(this_ptr_conv);
23872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23873 if ((this_ptr & 1) != 0) return;
23874 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23875 CHECK_ACCESS(this_ptr_ptr);
23876 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
23877 FREE((void*)this_ptr);
23878 EventsProvider_free(this_ptr_conv);
23881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23882 if ((this_ptr & 1) != 0) return;
23883 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23884 CHECK_ACCESS(this_ptr_ptr);
23885 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
23886 FREE((void*)this_ptr);
23887 EventHandler_free(this_ptr_conv);
23890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23891 if ((this_ptr & 1) != 0) return;
23892 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23893 CHECK_ACCESS(this_ptr_ptr);
23894 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
23895 FREE((void*)this_ptr);
23896 APIError_free(this_ptr_conv);
23899 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
23900 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23901 *ret_copy = APIError_clone(arg);
23902 int64_t ret_ref = (uintptr_t)ret_copy;
23905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23906 LDKAPIError* arg_conv = (LDKAPIError*)arg;
23907 int64_t ret_conv = APIError_clone_ptr(arg_conv);
23911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23912 LDKAPIError* orig_conv = (LDKAPIError*)orig;
23913 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23914 *ret_copy = APIError_clone(orig_conv);
23915 int64_t ret_ref = (uintptr_t)ret_copy;
23919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
23920 LDKStr err_conv = java_to_owned_str(env, err);
23921 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23922 *ret_copy = APIError_apimisuse_error(err_conv);
23923 int64_t ret_ref = (uintptr_t)ret_copy;
23927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
23928 LDKStr err_conv = java_to_owned_str(env, err);
23929 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23930 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
23931 int64_t ret_ref = (uintptr_t)ret_copy;
23935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
23936 LDKStr err_conv = java_to_owned_str(env, err);
23937 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23938 *ret_copy = APIError_route_error(err_conv);
23939 int64_t ret_ref = (uintptr_t)ret_copy;
23943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
23944 LDKStr err_conv = java_to_owned_str(env, err);
23945 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23946 *ret_copy = APIError_channel_unavailable(err_conv);
23947 int64_t ret_ref = (uintptr_t)ret_copy;
23951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
23952 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23953 *ret_copy = APIError_monitor_update_failed();
23954 int64_t ret_ref = (uintptr_t)ret_copy;
23958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
23959 LDKShutdownScript script_conv;
23960 script_conv.inner = (void*)(script & (~1));
23961 script_conv.is_owned = (script & 1) || (script == 0);
23962 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
23963 script_conv = ShutdownScript_clone(&script_conv);
23964 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23965 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
23966 int64_t ret_ref = (uintptr_t)ret_copy;
23970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
23971 LDKu8slice msg_ref;
23972 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23973 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23974 unsigned char sk_arr[32];
23975 CHECK((*env)->GetArrayLength(env, sk) == 32);
23976 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
23977 unsigned char (*sk_ref)[32] = &sk_arr;
23978 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
23979 *ret_conv = sign(msg_ref, sk_ref);
23980 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23981 return (int64_t)ret_conv;
23984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
23985 LDKu8slice msg_ref;
23986 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23987 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23988 LDKStr sig_conv = java_to_owned_str(env, sig);
23989 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
23990 *ret_conv = recover_pk(msg_ref, sig_conv);
23991 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23992 return (int64_t)ret_conv;
23995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
23996 LDKu8slice msg_ref;
23997 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23998 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23999 LDKStr sig_conv = java_to_owned_str(env, sig);
24000 LDKPublicKey pk_ref;
24001 CHECK((*env)->GetArrayLength(env, pk) == 33);
24002 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
24003 jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
24004 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
24008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
24009 LDKu8slice hrp_bytes_ref;
24010 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
24011 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
24012 LDKCVec_u5Z data_without_signature_constr;
24013 data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
24014 if (data_without_signature_constr.datalen > 0)
24015 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
24017 data_without_signature_constr.data = NULL;
24018 int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
24019 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
24020 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
24022 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
24024 (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
24025 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
24026 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24027 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24028 CVec_u8Z_free(ret_var);
24029 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
24033 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24034 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
24035 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
24039 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
24040 jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
24044 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
24045 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
24049 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
24050 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
24054 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
24055 jclass ret_conv = LDKLevel_to_java(env, Level_info());
24059 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
24060 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
24064 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
24065 jclass ret_conv = LDKLevel_to_java(env, Level_error());
24069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24070 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
24071 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
24072 jboolean ret_conv = Level_eq(a_conv, b_conv);
24076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
24077 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
24078 int64_t ret_conv = Level_hash(o_conv);
24082 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
24083 jclass ret_conv = LDKLevel_to_java(env, Level_max());
24087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24088 LDKRecord this_obj_conv;
24089 this_obj_conv.inner = (void*)(this_obj & (~1));
24090 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24092 Record_free(this_obj_conv);
24095 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
24096 LDKRecord this_ptr_conv;
24097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24098 this_ptr_conv.is_owned = false;
24099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24100 jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
24104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
24105 LDKRecord this_ptr_conv;
24106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24107 this_ptr_conv.is_owned = false;
24108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24109 LDKLevel val_conv = LDKLevel_from_java(env, val);
24110 Record_set_level(&this_ptr_conv, val_conv);
24113 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
24114 LDKRecord this_ptr_conv;
24115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24116 this_ptr_conv.is_owned = false;
24117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24118 LDKStr ret_str = Record_get_args(&this_ptr_conv);
24119 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24125 LDKRecord this_ptr_conv;
24126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24127 this_ptr_conv.is_owned = false;
24128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24129 LDKStr val_conv = java_to_owned_str(env, val);
24130 Record_set_args(&this_ptr_conv, val_conv);
24133 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
24134 LDKRecord this_ptr_conv;
24135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24136 this_ptr_conv.is_owned = false;
24137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24138 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
24139 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24145 LDKRecord this_ptr_conv;
24146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24147 this_ptr_conv.is_owned = false;
24148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24149 LDKStr val_conv = java_to_owned_str(env, val);
24150 Record_set_module_path(&this_ptr_conv, val_conv);
24153 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
24154 LDKRecord this_ptr_conv;
24155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24156 this_ptr_conv.is_owned = false;
24157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24158 LDKStr ret_str = Record_get_file(&this_ptr_conv);
24159 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
24165 LDKRecord this_ptr_conv;
24166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24167 this_ptr_conv.is_owned = false;
24168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24169 LDKStr val_conv = java_to_owned_str(env, val);
24170 Record_set_file(&this_ptr_conv, val_conv);
24173 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
24174 LDKRecord this_ptr_conv;
24175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24176 this_ptr_conv.is_owned = false;
24177 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24178 int32_t ret_conv = Record_get_line(&this_ptr_conv);
24182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24183 LDKRecord this_ptr_conv;
24184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24185 this_ptr_conv.is_owned = false;
24186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24187 Record_set_line(&this_ptr_conv, val);
24190 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
24191 LDKRecord ret_var = Record_clone(arg);
24192 int64_t ret_ref = 0;
24193 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24194 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24195 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24196 ret_ref = (uintptr_t)ret_var.inner;
24197 if (ret_var.is_owned) {
24202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24203 LDKRecord arg_conv;
24204 arg_conv.inner = (void*)(arg & (~1));
24205 arg_conv.is_owned = false;
24206 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24207 int64_t ret_conv = Record_clone_ptr(&arg_conv);
24211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24212 LDKRecord orig_conv;
24213 orig_conv.inner = (void*)(orig & (~1));
24214 orig_conv.is_owned = false;
24215 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24216 LDKRecord ret_var = Record_clone(&orig_conv);
24217 int64_t ret_ref = 0;
24218 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24219 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24220 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24221 ret_ref = (uintptr_t)ret_var.inner;
24222 if (ret_var.is_owned) {
24228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24229 if ((this_ptr & 1) != 0) return;
24230 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24231 CHECK_ACCESS(this_ptr_ptr);
24232 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
24233 FREE((void*)this_ptr);
24234 Logger_free(this_ptr_conv);
24237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24238 LDKChannelHandshakeConfig this_obj_conv;
24239 this_obj_conv.inner = (void*)(this_obj & (~1));
24240 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24241 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24242 ChannelHandshakeConfig_free(this_obj_conv);
24245 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24246 LDKChannelHandshakeConfig this_ptr_conv;
24247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24248 this_ptr_conv.is_owned = false;
24249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24250 int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
24254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24255 LDKChannelHandshakeConfig this_ptr_conv;
24256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24257 this_ptr_conv.is_owned = false;
24258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24259 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
24262 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24263 LDKChannelHandshakeConfig this_ptr_conv;
24264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24265 this_ptr_conv.is_owned = false;
24266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24267 int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
24271 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) {
24272 LDKChannelHandshakeConfig this_ptr_conv;
24273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24274 this_ptr_conv.is_owned = false;
24275 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24276 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
24279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24280 LDKChannelHandshakeConfig this_ptr_conv;
24281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24282 this_ptr_conv.is_owned = false;
24283 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24284 int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
24288 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) {
24289 LDKChannelHandshakeConfig this_ptr_conv;
24290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24291 this_ptr_conv.is_owned = false;
24292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24293 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
24296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
24297 LDKChannelHandshakeConfig this_ptr_conv;
24298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24299 this_ptr_conv.is_owned = false;
24300 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24301 jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
24305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24306 LDKChannelHandshakeConfig this_ptr_conv;
24307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24308 this_ptr_conv.is_owned = false;
24309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24310 ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
24313 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, jboolean negotiate_scid_privacy_arg) {
24314 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, negotiate_scid_privacy_arg);
24315 int64_t ret_ref = 0;
24316 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24317 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24319 ret_ref = (uintptr_t)ret_var.inner;
24320 if (ret_var.is_owned) {
24326 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
24327 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
24328 int64_t ret_ref = 0;
24329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24332 ret_ref = (uintptr_t)ret_var.inner;
24333 if (ret_var.is_owned) {
24338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24339 LDKChannelHandshakeConfig arg_conv;
24340 arg_conv.inner = (void*)(arg & (~1));
24341 arg_conv.is_owned = false;
24342 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24343 int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
24347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24348 LDKChannelHandshakeConfig orig_conv;
24349 orig_conv.inner = (void*)(orig & (~1));
24350 orig_conv.is_owned = false;
24351 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24352 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
24353 int64_t ret_ref = 0;
24354 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24355 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24357 ret_ref = (uintptr_t)ret_var.inner;
24358 if (ret_var.is_owned) {
24364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
24365 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
24366 int64_t ret_ref = 0;
24367 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24368 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24370 ret_ref = (uintptr_t)ret_var.inner;
24371 if (ret_var.is_owned) {
24377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24378 LDKChannelHandshakeLimits this_obj_conv;
24379 this_obj_conv.inner = (void*)(this_obj & (~1));
24380 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24382 ChannelHandshakeLimits_free(this_obj_conv);
24385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24386 LDKChannelHandshakeLimits this_ptr_conv;
24387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24388 this_ptr_conv.is_owned = false;
24389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24390 int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
24394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24395 LDKChannelHandshakeLimits this_ptr_conv;
24396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24397 this_ptr_conv.is_owned = false;
24398 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24399 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
24402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24403 LDKChannelHandshakeLimits this_ptr_conv;
24404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24405 this_ptr_conv.is_owned = false;
24406 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24407 int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
24411 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) {
24412 LDKChannelHandshakeLimits this_ptr_conv;
24413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24414 this_ptr_conv.is_owned = false;
24415 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24416 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
24419 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) {
24420 LDKChannelHandshakeLimits this_ptr_conv;
24421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24422 this_ptr_conv.is_owned = false;
24423 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24424 int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
24428 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) {
24429 LDKChannelHandshakeLimits this_ptr_conv;
24430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24431 this_ptr_conv.is_owned = false;
24432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24433 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
24436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24437 LDKChannelHandshakeLimits this_ptr_conv;
24438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24439 this_ptr_conv.is_owned = false;
24440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24441 int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
24445 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) {
24446 LDKChannelHandshakeLimits this_ptr_conv;
24447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24448 this_ptr_conv.is_owned = false;
24449 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24450 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
24453 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
24454 LDKChannelHandshakeLimits this_ptr_conv;
24455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24456 this_ptr_conv.is_owned = false;
24457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24458 int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
24462 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) {
24463 LDKChannelHandshakeLimits this_ptr_conv;
24464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24465 this_ptr_conv.is_owned = false;
24466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24467 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
24470 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24471 LDKChannelHandshakeLimits this_ptr_conv;
24472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24473 this_ptr_conv.is_owned = false;
24474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24475 int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
24479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24480 LDKChannelHandshakeLimits this_ptr_conv;
24481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24482 this_ptr_conv.is_owned = false;
24483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24484 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
24487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
24488 LDKChannelHandshakeLimits this_ptr_conv;
24489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24490 this_ptr_conv.is_owned = false;
24491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24492 jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
24496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24497 LDKChannelHandshakeLimits this_ptr_conv;
24498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24499 this_ptr_conv.is_owned = false;
24500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24501 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
24504 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24505 LDKChannelHandshakeLimits this_ptr_conv;
24506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24507 this_ptr_conv.is_owned = false;
24508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24509 int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
24513 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) {
24514 LDKChannelHandshakeLimits this_ptr_conv;
24515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24516 this_ptr_conv.is_owned = false;
24517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24518 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
24521 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) {
24522 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);
24523 int64_t ret_ref = 0;
24524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24527 ret_ref = (uintptr_t)ret_var.inner;
24528 if (ret_var.is_owned) {
24534 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
24535 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
24536 int64_t ret_ref = 0;
24537 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24538 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24540 ret_ref = (uintptr_t)ret_var.inner;
24541 if (ret_var.is_owned) {
24546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24547 LDKChannelHandshakeLimits arg_conv;
24548 arg_conv.inner = (void*)(arg & (~1));
24549 arg_conv.is_owned = false;
24550 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24551 int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
24555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24556 LDKChannelHandshakeLimits orig_conv;
24557 orig_conv.inner = (void*)(orig & (~1));
24558 orig_conv.is_owned = false;
24559 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24560 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
24561 int64_t ret_ref = 0;
24562 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24563 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24564 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24565 ret_ref = (uintptr_t)ret_var.inner;
24566 if (ret_var.is_owned) {
24572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
24573 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
24574 int64_t ret_ref = 0;
24575 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24576 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24578 ret_ref = (uintptr_t)ret_var.inner;
24579 if (ret_var.is_owned) {
24585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24586 LDKChannelConfig this_obj_conv;
24587 this_obj_conv.inner = (void*)(this_obj & (~1));
24588 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24590 ChannelConfig_free(this_obj_conv);
24593 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
24594 LDKChannelConfig this_ptr_conv;
24595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24596 this_ptr_conv.is_owned = false;
24597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24598 int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
24602 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) {
24603 LDKChannelConfig this_ptr_conv;
24604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24605 this_ptr_conv.is_owned = false;
24606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24607 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
24610 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24611 LDKChannelConfig this_ptr_conv;
24612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24613 this_ptr_conv.is_owned = false;
24614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24615 int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
24619 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) {
24620 LDKChannelConfig this_ptr_conv;
24621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24622 this_ptr_conv.is_owned = false;
24623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24624 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
24627 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24628 LDKChannelConfig this_ptr_conv;
24629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24630 this_ptr_conv.is_owned = false;
24631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24632 int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
24636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
24637 LDKChannelConfig this_ptr_conv;
24638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24639 this_ptr_conv.is_owned = false;
24640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24641 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
24644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
24645 LDKChannelConfig this_ptr_conv;
24646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24647 this_ptr_conv.is_owned = false;
24648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24649 jboolean ret_conv = ChannelConfig_get_announced_channel(&this_ptr_conv);
24653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24654 LDKChannelConfig this_ptr_conv;
24655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24656 this_ptr_conv.is_owned = false;
24657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24658 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
24661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24662 LDKChannelConfig this_ptr_conv;
24663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24664 this_ptr_conv.is_owned = false;
24665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24666 jboolean ret_conv = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
24670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24671 LDKChannelConfig this_ptr_conv;
24672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24673 this_ptr_conv.is_owned = false;
24674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24675 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
24678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24679 LDKChannelConfig this_ptr_conv;
24680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24681 this_ptr_conv.is_owned = false;
24682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24683 int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
24687 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) {
24688 LDKChannelConfig this_ptr_conv;
24689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24690 this_ptr_conv.is_owned = false;
24691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24692 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
24695 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) {
24696 LDKChannelConfig this_ptr_conv;
24697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24698 this_ptr_conv.is_owned = false;
24699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24700 int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
24704 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) {
24705 LDKChannelConfig this_ptr_conv;
24706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24707 this_ptr_conv.is_owned = false;
24708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24709 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
24712 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) {
24713 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);
24714 int64_t ret_ref = 0;
24715 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24716 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24718 ret_ref = (uintptr_t)ret_var.inner;
24719 if (ret_var.is_owned) {
24725 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
24726 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
24727 int64_t ret_ref = 0;
24728 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24729 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24730 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24731 ret_ref = (uintptr_t)ret_var.inner;
24732 if (ret_var.is_owned) {
24737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24738 LDKChannelConfig arg_conv;
24739 arg_conv.inner = (void*)(arg & (~1));
24740 arg_conv.is_owned = false;
24741 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24742 int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
24746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24747 LDKChannelConfig orig_conv;
24748 orig_conv.inner = (void*)(orig & (~1));
24749 orig_conv.is_owned = false;
24750 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24751 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
24752 int64_t ret_ref = 0;
24753 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24754 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24755 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24756 ret_ref = (uintptr_t)ret_var.inner;
24757 if (ret_var.is_owned) {
24763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
24764 LDKChannelConfig ret_var = ChannelConfig_default();
24765 int64_t ret_ref = 0;
24766 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24767 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24768 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24769 ret_ref = (uintptr_t)ret_var.inner;
24770 if (ret_var.is_owned) {
24776 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
24777 LDKChannelConfig obj_conv;
24778 obj_conv.inner = (void*)(obj & (~1));
24779 obj_conv.is_owned = false;
24780 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24781 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24782 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24783 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24784 CVec_u8Z_free(ret_var);
24788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24789 LDKu8slice ser_ref;
24790 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24791 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24792 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
24793 *ret_conv = ChannelConfig_read(ser_ref);
24794 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24795 return (int64_t)ret_conv;
24798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24799 LDKUserConfig this_obj_conv;
24800 this_obj_conv.inner = (void*)(this_obj & (~1));
24801 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24802 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24803 UserConfig_free(this_obj_conv);
24806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
24807 LDKUserConfig this_ptr_conv;
24808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24809 this_ptr_conv.is_owned = false;
24810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24811 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
24812 int64_t ret_ref = 0;
24813 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24814 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24816 ret_ref = (uintptr_t)ret_var.inner;
24817 if (ret_var.is_owned) {
24823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24824 LDKUserConfig this_ptr_conv;
24825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24826 this_ptr_conv.is_owned = false;
24827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24828 LDKChannelHandshakeConfig val_conv;
24829 val_conv.inner = (void*)(val & (~1));
24830 val_conv.is_owned = (val & 1) || (val == 0);
24831 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24832 val_conv = ChannelHandshakeConfig_clone(&val_conv);
24833 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
24836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
24837 LDKUserConfig this_ptr_conv;
24838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24839 this_ptr_conv.is_owned = false;
24840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24841 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
24842 int64_t ret_ref = 0;
24843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24846 ret_ref = (uintptr_t)ret_var.inner;
24847 if (ret_var.is_owned) {
24853 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) {
24854 LDKUserConfig this_ptr_conv;
24855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24856 this_ptr_conv.is_owned = false;
24857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24858 LDKChannelHandshakeLimits val_conv;
24859 val_conv.inner = (void*)(val & (~1));
24860 val_conv.is_owned = (val & 1) || (val == 0);
24861 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24862 val_conv = ChannelHandshakeLimits_clone(&val_conv);
24863 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
24866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
24867 LDKUserConfig this_ptr_conv;
24868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24869 this_ptr_conv.is_owned = false;
24870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24871 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
24872 int64_t ret_ref = 0;
24873 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24874 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24875 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24876 ret_ref = (uintptr_t)ret_var.inner;
24877 if (ret_var.is_owned) {
24883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24884 LDKUserConfig this_ptr_conv;
24885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24886 this_ptr_conv.is_owned = false;
24887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24888 LDKChannelConfig val_conv;
24889 val_conv.inner = (void*)(val & (~1));
24890 val_conv.is_owned = (val & 1) || (val == 0);
24891 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24892 val_conv = ChannelConfig_clone(&val_conv);
24893 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
24896 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24897 LDKUserConfig this_ptr_conv;
24898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24899 this_ptr_conv.is_owned = false;
24900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24901 jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
24905 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) {
24906 LDKUserConfig this_ptr_conv;
24907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24908 this_ptr_conv.is_owned = false;
24909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24910 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
24913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24914 LDKUserConfig this_ptr_conv;
24915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24916 this_ptr_conv.is_owned = false;
24917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24918 jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
24922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24923 LDKUserConfig this_ptr_conv;
24924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24925 this_ptr_conv.is_owned = false;
24926 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24927 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
24930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24931 LDKUserConfig 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 jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
24939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24940 LDKUserConfig this_ptr_conv;
24941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24942 this_ptr_conv.is_owned = false;
24943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24944 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
24947 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, jboolean manually_accept_inbound_channels_arg) {
24948 LDKChannelHandshakeConfig own_channel_config_arg_conv;
24949 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
24950 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
24951 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
24952 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
24953 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
24954 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
24955 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
24956 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
24957 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
24958 LDKChannelConfig channel_options_arg_conv;
24959 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
24960 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
24961 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
24962 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
24963 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, manually_accept_inbound_channels_arg);
24964 int64_t ret_ref = 0;
24965 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24966 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24967 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24968 ret_ref = (uintptr_t)ret_var.inner;
24969 if (ret_var.is_owned) {
24975 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24976 LDKUserConfig ret_var = UserConfig_clone(arg);
24977 int64_t ret_ref = 0;
24978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24981 ret_ref = (uintptr_t)ret_var.inner;
24982 if (ret_var.is_owned) {
24987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24988 LDKUserConfig arg_conv;
24989 arg_conv.inner = (void*)(arg & (~1));
24990 arg_conv.is_owned = false;
24991 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24992 int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
24996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24997 LDKUserConfig orig_conv;
24998 orig_conv.inner = (void*)(orig & (~1));
24999 orig_conv.is_owned = false;
25000 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25001 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
25002 int64_t ret_ref = 0;
25003 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25004 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25005 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25006 ret_ref = (uintptr_t)ret_var.inner;
25007 if (ret_var.is_owned) {
25013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
25014 LDKUserConfig ret_var = UserConfig_default();
25015 int64_t ret_ref = 0;
25016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25019 ret_ref = (uintptr_t)ret_var.inner;
25020 if (ret_var.is_owned) {
25026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25027 LDKBestBlock this_obj_conv;
25028 this_obj_conv.inner = (void*)(this_obj & (~1));
25029 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25031 BestBlock_free(this_obj_conv);
25034 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
25035 LDKBestBlock ret_var = BestBlock_clone(arg);
25036 int64_t ret_ref = 0;
25037 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25038 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25040 ret_ref = (uintptr_t)ret_var.inner;
25041 if (ret_var.is_owned) {
25046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25047 LDKBestBlock arg_conv;
25048 arg_conv.inner = (void*)(arg & (~1));
25049 arg_conv.is_owned = false;
25050 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25051 int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
25055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25056 LDKBestBlock orig_conv;
25057 orig_conv.inner = (void*)(orig & (~1));
25058 orig_conv.is_owned = false;
25059 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25060 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
25061 int64_t ret_ref = 0;
25062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25065 ret_ref = (uintptr_t)ret_var.inner;
25066 if (ret_var.is_owned) {
25072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
25073 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
25074 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
25075 int64_t ret_ref = 0;
25076 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25077 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25078 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25079 ret_ref = (uintptr_t)ret_var.inner;
25080 if (ret_var.is_owned) {
25086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
25087 LDKThirtyTwoBytes block_hash_ref;
25088 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
25089 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
25090 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
25091 int64_t ret_ref = 0;
25092 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25093 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25095 ret_ref = (uintptr_t)ret_var.inner;
25096 if (ret_var.is_owned) {
25102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25103 LDKBestBlock this_arg_conv;
25104 this_arg_conv.inner = (void*)(this_arg & (~1));
25105 this_arg_conv.is_owned = false;
25106 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25107 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25108 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
25112 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
25113 LDKBestBlock this_arg_conv;
25114 this_arg_conv.inner = (void*)(this_arg & (~1));
25115 this_arg_conv.is_owned = false;
25116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25117 int32_t ret_conv = BestBlock_height(&this_arg_conv);
25121 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25122 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
25123 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
25127 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
25128 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
25132 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
25133 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
25137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25138 if ((this_ptr & 1) != 0) return;
25139 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25140 CHECK_ACCESS(this_ptr_ptr);
25141 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
25142 FREE((void*)this_ptr);
25143 Access_free(this_ptr_conv);
25146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25147 if ((this_ptr & 1) != 0) return;
25148 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25149 CHECK_ACCESS(this_ptr_ptr);
25150 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
25151 FREE((void*)this_ptr);
25152 Listen_free(this_ptr_conv);
25155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25156 if ((this_ptr & 1) != 0) return;
25157 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25158 CHECK_ACCESS(this_ptr_ptr);
25159 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
25160 FREE((void*)this_ptr);
25161 Confirm_free(this_ptr_conv);
25164 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25165 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
25166 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
25170 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
25171 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
25175 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
25176 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
25180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25181 if ((this_ptr & 1) != 0) return;
25182 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25183 CHECK_ACCESS(this_ptr_ptr);
25184 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
25185 FREE((void*)this_ptr);
25186 Watch_free(this_ptr_conv);
25189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25190 if ((this_ptr & 1) != 0) return;
25191 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25192 CHECK_ACCESS(this_ptr_ptr);
25193 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
25194 FREE((void*)this_ptr);
25195 Filter_free(this_ptr_conv);
25198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25199 LDKWatchedOutput this_obj_conv;
25200 this_obj_conv.inner = (void*)(this_obj & (~1));
25201 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25203 WatchedOutput_free(this_obj_conv);
25206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
25207 LDKWatchedOutput this_ptr_conv;
25208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25209 this_ptr_conv.is_owned = false;
25210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25211 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25212 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
25216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25217 LDKWatchedOutput this_ptr_conv;
25218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25219 this_ptr_conv.is_owned = false;
25220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25221 LDKThirtyTwoBytes val_ref;
25222 CHECK((*env)->GetArrayLength(env, val) == 32);
25223 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25224 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
25227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
25228 LDKWatchedOutput this_ptr_conv;
25229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25230 this_ptr_conv.is_owned = false;
25231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25232 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
25233 int64_t ret_ref = 0;
25234 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25235 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25236 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25237 ret_ref = (uintptr_t)ret_var.inner;
25238 if (ret_var.is_owned) {
25244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25245 LDKWatchedOutput this_ptr_conv;
25246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25247 this_ptr_conv.is_owned = false;
25248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25249 LDKOutPoint val_conv;
25250 val_conv.inner = (void*)(val & (~1));
25251 val_conv.is_owned = (val & 1) || (val == 0);
25252 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25253 val_conv = OutPoint_clone(&val_conv);
25254 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
25257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
25258 LDKWatchedOutput this_ptr_conv;
25259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25260 this_ptr_conv.is_owned = false;
25261 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25262 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
25263 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25264 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25269 LDKWatchedOutput this_ptr_conv;
25270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25271 this_ptr_conv.is_owned = false;
25272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25273 LDKCVec_u8Z val_ref;
25274 val_ref.datalen = (*env)->GetArrayLength(env, val);
25275 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
25276 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
25277 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
25280 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) {
25281 LDKThirtyTwoBytes block_hash_arg_ref;
25282 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
25283 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
25284 LDKOutPoint outpoint_arg_conv;
25285 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
25286 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
25287 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25288 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25289 LDKCVec_u8Z script_pubkey_arg_ref;
25290 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
25291 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
25292 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
25293 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
25294 int64_t ret_ref = 0;
25295 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25296 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25297 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25298 ret_ref = (uintptr_t)ret_var.inner;
25299 if (ret_var.is_owned) {
25305 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
25306 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
25307 int64_t ret_ref = 0;
25308 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25309 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25310 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25311 ret_ref = (uintptr_t)ret_var.inner;
25312 if (ret_var.is_owned) {
25317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25318 LDKWatchedOutput arg_conv;
25319 arg_conv.inner = (void*)(arg & (~1));
25320 arg_conv.is_owned = false;
25321 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25322 int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
25326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25327 LDKWatchedOutput orig_conv;
25328 orig_conv.inner = (void*)(orig & (~1));
25329 orig_conv.is_owned = false;
25330 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25331 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
25332 int64_t ret_ref = 0;
25333 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25334 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25335 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25336 ret_ref = (uintptr_t)ret_var.inner;
25337 if (ret_var.is_owned) {
25343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
25344 LDKWatchedOutput o_conv;
25345 o_conv.inner = (void*)(o & (~1));
25346 o_conv.is_owned = false;
25347 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25348 int64_t ret_conv = WatchedOutput_hash(&o_conv);
25352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25353 if ((this_ptr & 1) != 0) return;
25354 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25355 CHECK_ACCESS(this_ptr_ptr);
25356 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
25357 FREE((void*)this_ptr);
25358 BroadcasterInterface_free(this_ptr_conv);
25361 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25362 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
25363 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
25367 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
25368 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
25372 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
25373 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
25377 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
25378 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
25382 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25383 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
25384 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
25385 jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
25389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25390 if ((this_ptr & 1) != 0) return;
25391 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25392 CHECK_ACCESS(this_ptr_ptr);
25393 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
25394 FREE((void*)this_ptr);
25395 FeeEstimator_free(this_ptr_conv);
25398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25399 LDKMonitorUpdateId this_obj_conv;
25400 this_obj_conv.inner = (void*)(this_obj & (~1));
25401 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25403 MonitorUpdateId_free(this_obj_conv);
25406 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
25407 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
25408 int64_t ret_ref = 0;
25409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25412 ret_ref = (uintptr_t)ret_var.inner;
25413 if (ret_var.is_owned) {
25418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25419 LDKMonitorUpdateId arg_conv;
25420 arg_conv.inner = (void*)(arg & (~1));
25421 arg_conv.is_owned = false;
25422 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25423 int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
25427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25428 LDKMonitorUpdateId orig_conv;
25429 orig_conv.inner = (void*)(orig & (~1));
25430 orig_conv.is_owned = false;
25431 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25432 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
25433 int64_t ret_ref = 0;
25434 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25435 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25437 ret_ref = (uintptr_t)ret_var.inner;
25438 if (ret_var.is_owned) {
25444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
25445 LDKMonitorUpdateId o_conv;
25446 o_conv.inner = (void*)(o & (~1));
25447 o_conv.is_owned = false;
25448 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25449 int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
25453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25454 LDKMonitorUpdateId a_conv;
25455 a_conv.inner = (void*)(a & (~1));
25456 a_conv.is_owned = false;
25457 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25458 LDKMonitorUpdateId b_conv;
25459 b_conv.inner = (void*)(b & (~1));
25460 b_conv.is_owned = false;
25461 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25462 jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
25466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25467 if ((this_ptr & 1) != 0) return;
25468 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25469 CHECK_ACCESS(this_ptr_ptr);
25470 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
25471 FREE((void*)this_ptr);
25472 Persist_free(this_ptr_conv);
25475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25476 LDKLockedChannelMonitor this_obj_conv;
25477 this_obj_conv.inner = (void*)(this_obj & (~1));
25478 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25480 LockedChannelMonitor_free(this_obj_conv);
25483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25484 LDKChainMonitor this_obj_conv;
25485 this_obj_conv.inner = (void*)(this_obj & (~1));
25486 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25488 ChainMonitor_free(this_obj_conv);
25491 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) {
25492 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
25493 CHECK_ACCESS(chain_source_ptr);
25494 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
25495 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
25496 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
25497 // Manually implement clone for Java trait instances
25498 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
25499 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25500 LDKFilter_JCalls_cloned(&chain_source_conv.some);
25503 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25504 CHECK_ACCESS(broadcaster_ptr);
25505 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25506 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25507 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25508 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25510 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25511 CHECK_ACCESS(logger_ptr);
25512 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25513 if (logger_conv.free == LDKLogger_JCalls_free) {
25514 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25515 LDKLogger_JCalls_cloned(&logger_conv);
25517 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
25518 CHECK_ACCESS(feeest_ptr);
25519 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
25520 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
25521 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25522 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
25524 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
25525 CHECK_ACCESS(persister_ptr);
25526 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
25527 if (persister_conv.free == LDKPersist_JCalls_free) {
25528 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25529 LDKPersist_JCalls_cloned(&persister_conv);
25531 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
25532 int64_t ret_ref = 0;
25533 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25534 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25535 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25536 ret_ref = (uintptr_t)ret_var.inner;
25537 if (ret_var.is_owned) {
25543 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) {
25544 LDKChainMonitor this_arg_conv;
25545 this_arg_conv.inner = (void*)(this_arg & (~1));
25546 this_arg_conv.is_owned = false;
25547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25548 LDKCVec_ChannelDetailsZ ignored_channels_constr;
25549 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
25550 if (ignored_channels_constr.datalen > 0)
25551 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25553 ignored_channels_constr.data = NULL;
25554 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
25555 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
25556 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
25557 LDKChannelDetails ignored_channels_conv_16_conv;
25558 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
25559 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
25560 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
25561 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
25562 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
25564 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
25565 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
25566 int64_tArray ret_arr = NULL;
25567 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25568 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25569 for (size_t j = 0; j < ret_var.datalen; j++) {
25570 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25571 *ret_conv_9_copy = ret_var.data[j];
25572 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
25573 ret_arr_ptr[j] = ret_conv_9_ref;
25575 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25576 FREE(ret_var.data);
25580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
25581 LDKChainMonitor this_arg_conv;
25582 this_arg_conv.inner = (void*)(this_arg & (~1));
25583 this_arg_conv.is_owned = false;
25584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25585 LDKOutPoint funding_txo_conv;
25586 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25587 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25588 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25589 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25590 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
25591 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
25592 return (int64_t)ret_conv;
25595 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
25596 LDKChainMonitor this_arg_conv;
25597 this_arg_conv.inner = (void*)(this_arg & (~1));
25598 this_arg_conv.is_owned = false;
25599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25600 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
25601 int64_tArray ret_arr = NULL;
25602 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25603 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25604 for (size_t k = 0; k < ret_var.datalen; k++) {
25605 LDKOutPoint ret_conv_10_var = ret_var.data[k];
25606 int64_t ret_conv_10_ref = 0;
25607 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25608 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
25610 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
25611 if (ret_conv_10_var.is_owned) {
25612 ret_conv_10_ref |= 1;
25614 ret_arr_ptr[k] = ret_conv_10_ref;
25616 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25617 FREE(ret_var.data);
25621 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) {
25622 LDKChainMonitor this_arg_conv;
25623 this_arg_conv.inner = (void*)(this_arg & (~1));
25624 this_arg_conv.is_owned = false;
25625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25626 LDKOutPoint funding_txo_conv;
25627 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25628 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25629 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25630 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25631 LDKMonitorUpdateId completed_update_id_conv;
25632 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
25633 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
25634 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
25635 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
25636 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25637 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
25638 return (int64_t)ret_conv;
25641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
25642 LDKChainMonitor this_arg_conv;
25643 this_arg_conv.inner = (void*)(this_arg & (~1));
25644 this_arg_conv.is_owned = false;
25645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25646 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
25647 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
25648 return (int64_t)ret_ret;
25651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
25652 LDKChainMonitor this_arg_conv;
25653 this_arg_conv.inner = (void*)(this_arg & (~1));
25654 this_arg_conv.is_owned = false;
25655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25656 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
25657 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
25658 return (int64_t)ret_ret;
25661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
25662 LDKChainMonitor this_arg_conv;
25663 this_arg_conv.inner = (void*)(this_arg & (~1));
25664 this_arg_conv.is_owned = false;
25665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25666 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
25667 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
25668 return (int64_t)ret_ret;
25671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25672 LDKChainMonitor 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 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
25677 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
25678 return (int64_t)ret_ret;
25681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25682 LDKChannelMonitorUpdate this_obj_conv;
25683 this_obj_conv.inner = (void*)(this_obj & (~1));
25684 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25686 ChannelMonitorUpdate_free(this_obj_conv);
25689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
25690 LDKChannelMonitorUpdate this_ptr_conv;
25691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25692 this_ptr_conv.is_owned = false;
25693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25694 int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
25698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25699 LDKChannelMonitorUpdate this_ptr_conv;
25700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25701 this_ptr_conv.is_owned = false;
25702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25703 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
25706 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
25707 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
25708 int64_t ret_ref = 0;
25709 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25710 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25712 ret_ref = (uintptr_t)ret_var.inner;
25713 if (ret_var.is_owned) {
25718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25719 LDKChannelMonitorUpdate arg_conv;
25720 arg_conv.inner = (void*)(arg & (~1));
25721 arg_conv.is_owned = false;
25722 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25723 int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
25727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25728 LDKChannelMonitorUpdate orig_conv;
25729 orig_conv.inner = (void*)(orig & (~1));
25730 orig_conv.is_owned = false;
25731 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25732 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
25733 int64_t ret_ref = 0;
25734 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25735 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25737 ret_ref = (uintptr_t)ret_var.inner;
25738 if (ret_var.is_owned) {
25744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25745 LDKChannelMonitorUpdate obj_conv;
25746 obj_conv.inner = (void*)(obj & (~1));
25747 obj_conv.is_owned = false;
25748 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25749 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25750 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25751 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25752 CVec_u8Z_free(ret_var);
25756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25757 LDKu8slice ser_ref;
25758 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25759 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25760 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25761 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25762 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25763 return (int64_t)ret_conv;
25766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25767 if ((this_ptr & 1) != 0) return;
25768 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25769 CHECK_ACCESS(this_ptr_ptr);
25770 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25771 FREE((void*)this_ptr);
25772 MonitorEvent_free(this_ptr_conv);
25775 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25776 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25777 *ret_copy = MonitorEvent_clone(arg);
25778 int64_t ret_ref = (uintptr_t)ret_copy;
25781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25782 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
25783 int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
25787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25788 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
25789 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25790 *ret_copy = MonitorEvent_clone(orig_conv);
25791 int64_t ret_ref = (uintptr_t)ret_copy;
25795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
25796 LDKHTLCUpdate a_conv;
25797 a_conv.inner = (void*)(a & (~1));
25798 a_conv.is_owned = (a & 1) || (a == 0);
25799 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25800 a_conv = HTLCUpdate_clone(&a_conv);
25801 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25802 *ret_copy = MonitorEvent_htlcevent(a_conv);
25803 int64_t ret_ref = (uintptr_t)ret_copy;
25807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
25808 LDKOutPoint a_conv;
25809 a_conv.inner = (void*)(a & (~1));
25810 a_conv.is_owned = (a & 1) || (a == 0);
25811 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25812 a_conv = OutPoint_clone(&a_conv);
25813 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25814 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25815 int64_t ret_ref = (uintptr_t)ret_copy;
25819 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) {
25820 LDKOutPoint funding_txo_conv;
25821 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25822 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25823 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25824 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25825 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25826 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
25827 int64_t ret_ref = (uintptr_t)ret_copy;
25831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
25832 LDKOutPoint a_conv;
25833 a_conv.inner = (void*)(a & (~1));
25834 a_conv.is_owned = (a & 1) || (a == 0);
25835 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25836 a_conv = OutPoint_clone(&a_conv);
25837 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25838 *ret_copy = MonitorEvent_update_failed(a_conv);
25839 int64_t ret_ref = (uintptr_t)ret_copy;
25843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
25844 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
25845 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
25846 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25847 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25848 CVec_u8Z_free(ret_var);
25852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25853 LDKu8slice ser_ref;
25854 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25855 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25856 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25857 *ret_conv = MonitorEvent_read(ser_ref);
25858 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25859 return (int64_t)ret_conv;
25862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25863 LDKHTLCUpdate this_obj_conv;
25864 this_obj_conv.inner = (void*)(this_obj & (~1));
25865 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25867 HTLCUpdate_free(this_obj_conv);
25870 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
25871 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
25872 int64_t ret_ref = 0;
25873 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25874 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25875 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25876 ret_ref = (uintptr_t)ret_var.inner;
25877 if (ret_var.is_owned) {
25882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25883 LDKHTLCUpdate arg_conv;
25884 arg_conv.inner = (void*)(arg & (~1));
25885 arg_conv.is_owned = false;
25886 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25887 int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
25891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25892 LDKHTLCUpdate orig_conv;
25893 orig_conv.inner = (void*)(orig & (~1));
25894 orig_conv.is_owned = false;
25895 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25896 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
25897 int64_t ret_ref = 0;
25898 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25899 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25900 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25901 ret_ref = (uintptr_t)ret_var.inner;
25902 if (ret_var.is_owned) {
25908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25909 LDKHTLCUpdate obj_conv;
25910 obj_conv.inner = (void*)(obj & (~1));
25911 obj_conv.is_owned = false;
25912 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25913 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25914 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25915 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25916 CVec_u8Z_free(ret_var);
25920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25921 LDKu8slice ser_ref;
25922 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25923 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25924 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25925 *ret_conv = HTLCUpdate_read(ser_ref);
25926 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25927 return (int64_t)ret_conv;
25930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25931 if ((this_ptr & 1) != 0) return;
25932 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25933 CHECK_ACCESS(this_ptr_ptr);
25934 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25935 FREE((void*)this_ptr);
25936 Balance_free(this_ptr_conv);
25939 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25940 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25941 *ret_copy = Balance_clone(arg);
25942 int64_t ret_ref = (uintptr_t)ret_copy;
25945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25946 LDKBalance* arg_conv = (LDKBalance*)arg;
25947 int64_t ret_conv = Balance_clone_ptr(arg_conv);
25951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25952 LDKBalance* orig_conv = (LDKBalance*)orig;
25953 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25954 *ret_copy = Balance_clone(orig_conv);
25955 int64_t ret_ref = (uintptr_t)ret_copy;
25959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
25960 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25961 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25962 int64_t ret_ref = (uintptr_t)ret_copy;
25966 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) {
25967 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25968 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25969 int64_t ret_ref = (uintptr_t)ret_copy;
25973 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) {
25974 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25975 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25976 int64_t ret_ref = (uintptr_t)ret_copy;
25980 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) {
25981 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25982 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
25983 int64_t ret_ref = (uintptr_t)ret_copy;
25987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25988 LDKBalance* a_conv = (LDKBalance*)a;
25989 LDKBalance* b_conv = (LDKBalance*)b;
25990 jboolean ret_conv = Balance_eq(a_conv, b_conv);
25994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25995 LDKChannelMonitor this_obj_conv;
25996 this_obj_conv.inner = (void*)(this_obj & (~1));
25997 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25999 ChannelMonitor_free(this_obj_conv);
26002 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
26003 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
26004 int64_t ret_ref = 0;
26005 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26006 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26007 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26008 ret_ref = (uintptr_t)ret_var.inner;
26009 if (ret_var.is_owned) {
26014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26015 LDKChannelMonitor arg_conv;
26016 arg_conv.inner = (void*)(arg & (~1));
26017 arg_conv.is_owned = false;
26018 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26019 int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
26023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26024 LDKChannelMonitor orig_conv;
26025 orig_conv.inner = (void*)(orig & (~1));
26026 orig_conv.is_owned = false;
26027 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26028 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
26029 int64_t ret_ref = 0;
26030 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26031 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26033 ret_ref = (uintptr_t)ret_var.inner;
26034 if (ret_var.is_owned) {
26040 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26041 LDKChannelMonitor obj_conv;
26042 obj_conv.inner = (void*)(obj & (~1));
26043 obj_conv.is_owned = false;
26044 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26045 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
26046 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26047 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26048 CVec_u8Z_free(ret_var);
26052 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) {
26053 LDKChannelMonitor this_arg_conv;
26054 this_arg_conv.inner = (void*)(this_arg & (~1));
26055 this_arg_conv.is_owned = false;
26056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26057 LDKChannelMonitorUpdate updates_conv;
26058 updates_conv.inner = (void*)(updates & (~1));
26059 updates_conv.is_owned = false;
26060 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
26061 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26062 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
26063 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
26064 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26065 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
26066 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
26067 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26068 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
26069 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26070 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
26071 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
26072 return (int64_t)ret_conv;
26075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26076 LDKChannelMonitor this_arg_conv;
26077 this_arg_conv.inner = (void*)(this_arg & (~1));
26078 this_arg_conv.is_owned = false;
26079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26080 int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
26084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
26085 LDKChannelMonitor this_arg_conv;
26086 this_arg_conv.inner = (void*)(this_arg & (~1));
26087 this_arg_conv.is_owned = false;
26088 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26089 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
26090 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
26091 return ((int64_t)ret_conv);
26094 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
26095 LDKChannelMonitor this_arg_conv;
26096 this_arg_conv.inner = (void*)(this_arg & (~1));
26097 this_arg_conv.is_owned = false;
26098 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26099 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
26100 int64_tArray ret_arr = NULL;
26101 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26102 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26103 for (size_t o = 0; o < ret_var.datalen; o++) {
26104 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
26105 *ret_conv_40_conv = ret_var.data[o];
26106 ret_arr_ptr[o] = ((int64_t)ret_conv_40_conv);
26108 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26109 FREE(ret_var.data);
26113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
26114 LDKChannelMonitor this_arg_conv;
26115 this_arg_conv.inner = (void*)(this_arg & (~1));
26116 this_arg_conv.is_owned = false;
26117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26118 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
26119 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
26120 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
26121 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
26124 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26125 LDKChannelMonitor this_arg_conv;
26126 this_arg_conv.inner = (void*)(this_arg & (~1));
26127 this_arg_conv.is_owned = false;
26128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26129 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
26130 int64_tArray ret_arr = NULL;
26131 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26132 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26133 for (size_t o = 0; o < ret_var.datalen; o++) {
26134 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
26135 *ret_conv_14_copy = ret_var.data[o];
26136 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
26137 ret_arr_ptr[o] = ret_conv_14_ref;
26139 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26140 FREE(ret_var.data);
26144 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
26145 LDKChannelMonitor this_arg_conv;
26146 this_arg_conv.inner = (void*)(this_arg & (~1));
26147 this_arg_conv.is_owned = false;
26148 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26149 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
26150 int64_tArray ret_arr = NULL;
26151 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26152 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26153 for (size_t h = 0; h < ret_var.datalen; h++) {
26154 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
26155 *ret_conv_7_copy = ret_var.data[h];
26156 int64_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
26157 ret_arr_ptr[h] = ret_conv_7_ref;
26159 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26160 FREE(ret_var.data);
26164 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) {
26165 LDKChannelMonitor this_arg_conv;
26166 this_arg_conv.inner = (void*)(this_arg & (~1));
26167 this_arg_conv.is_owned = false;
26168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26169 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26170 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
26171 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
26172 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
26173 jobjectArray ret_arr = NULL;
26174 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26176 for (size_t i = 0; i < ret_var.datalen; i++) {
26177 LDKTransaction ret_conv_8_var = ret_var.data[i];
26178 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
26179 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
26180 Transaction_free(ret_conv_8_var);
26181 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26184 FREE(ret_var.data);
26188 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) {
26189 LDKChannelMonitor this_arg_conv;
26190 this_arg_conv.inner = (void*)(this_arg & (~1));
26191 this_arg_conv.is_owned = false;
26192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26193 unsigned char header_arr[80];
26194 CHECK((*env)->GetArrayLength(env, header) == 80);
26195 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26196 unsigned char (*header_ref)[80] = &header_arr;
26197 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26198 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26199 if (txdata_constr.datalen > 0)
26200 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26202 txdata_constr.data = NULL;
26203 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26204 for (size_t c = 0; c < txdata_constr.datalen; c++) {
26205 int64_t txdata_conv_28 = txdata_vals[c];
26206 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
26207 CHECK_ACCESS(txdata_conv_28_ptr);
26208 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26209 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
26210 txdata_constr.data[c] = txdata_conv_28_conv;
26212 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26213 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26214 CHECK_ACCESS(broadcaster_ptr);
26215 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26216 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26217 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26218 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26220 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26221 CHECK_ACCESS(fee_estimator_ptr);
26222 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26223 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26224 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26225 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26227 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26228 CHECK_ACCESS(logger_ptr);
26229 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26230 if (logger_conv.free == LDKLogger_JCalls_free) {
26231 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26232 LDKLogger_JCalls_cloned(&logger_conv);
26234 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);
26235 int64_tArray ret_arr = NULL;
26236 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26237 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26238 for (size_t n = 0; n < ret_var.datalen; n++) {
26239 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26240 *ret_conv_39_conv = ret_var.data[n];
26241 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
26243 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26244 FREE(ret_var.data);
26248 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) {
26249 LDKChannelMonitor this_arg_conv;
26250 this_arg_conv.inner = (void*)(this_arg & (~1));
26251 this_arg_conv.is_owned = false;
26252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26253 unsigned char header_arr[80];
26254 CHECK((*env)->GetArrayLength(env, header) == 80);
26255 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26256 unsigned char (*header_ref)[80] = &header_arr;
26257 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26258 CHECK_ACCESS(broadcaster_ptr);
26259 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26260 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26261 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26262 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26264 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26265 CHECK_ACCESS(fee_estimator_ptr);
26266 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26267 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26268 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26269 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26271 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26272 CHECK_ACCESS(logger_ptr);
26273 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26274 if (logger_conv.free == LDKLogger_JCalls_free) {
26275 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26276 LDKLogger_JCalls_cloned(&logger_conv);
26278 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26281 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) {
26282 LDKChannelMonitor this_arg_conv;
26283 this_arg_conv.inner = (void*)(this_arg & (~1));
26284 this_arg_conv.is_owned = false;
26285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26286 unsigned char header_arr[80];
26287 CHECK((*env)->GetArrayLength(env, header) == 80);
26288 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26289 unsigned char (*header_ref)[80] = &header_arr;
26290 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
26291 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
26292 if (txdata_constr.datalen > 0)
26293 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
26295 txdata_constr.data = NULL;
26296 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
26297 for (size_t c = 0; c < txdata_constr.datalen; c++) {
26298 int64_t txdata_conv_28 = txdata_vals[c];
26299 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
26300 CHECK_ACCESS(txdata_conv_28_ptr);
26301 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
26302 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
26303 txdata_constr.data[c] = txdata_conv_28_conv;
26305 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
26306 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26307 CHECK_ACCESS(broadcaster_ptr);
26308 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26309 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26310 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26311 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26313 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26314 CHECK_ACCESS(fee_estimator_ptr);
26315 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26316 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26317 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26318 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26320 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26321 CHECK_ACCESS(logger_ptr);
26322 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26323 if (logger_conv.free == LDKLogger_JCalls_free) {
26324 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26325 LDKLogger_JCalls_cloned(&logger_conv);
26327 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);
26328 int64_tArray ret_arr = NULL;
26329 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26330 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26331 for (size_t n = 0; n < ret_var.datalen; n++) {
26332 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26333 *ret_conv_39_conv = ret_var.data[n];
26334 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
26336 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26337 FREE(ret_var.data);
26341 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) {
26342 LDKChannelMonitor this_arg_conv;
26343 this_arg_conv.inner = (void*)(this_arg & (~1));
26344 this_arg_conv.is_owned = false;
26345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26346 unsigned char txid_arr[32];
26347 CHECK((*env)->GetArrayLength(env, txid) == 32);
26348 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
26349 unsigned char (*txid_ref)[32] = &txid_arr;
26350 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26351 CHECK_ACCESS(broadcaster_ptr);
26352 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26353 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26354 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26355 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26357 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26358 CHECK_ACCESS(fee_estimator_ptr);
26359 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26360 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26361 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26362 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26364 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26365 CHECK_ACCESS(logger_ptr);
26366 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26367 if (logger_conv.free == LDKLogger_JCalls_free) {
26368 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26369 LDKLogger_JCalls_cloned(&logger_conv);
26371 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
26374 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) {
26375 LDKChannelMonitor this_arg_conv;
26376 this_arg_conv.inner = (void*)(this_arg & (~1));
26377 this_arg_conv.is_owned = false;
26378 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26379 unsigned char header_arr[80];
26380 CHECK((*env)->GetArrayLength(env, header) == 80);
26381 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
26382 unsigned char (*header_ref)[80] = &header_arr;
26383 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
26384 CHECK_ACCESS(broadcaster_ptr);
26385 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
26386 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
26387 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26388 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
26390 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
26391 CHECK_ACCESS(fee_estimator_ptr);
26392 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
26393 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
26394 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26395 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
26397 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
26398 CHECK_ACCESS(logger_ptr);
26399 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
26400 if (logger_conv.free == LDKLogger_JCalls_free) {
26401 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26402 LDKLogger_JCalls_cloned(&logger_conv);
26404 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
26405 int64_tArray ret_arr = NULL;
26406 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26407 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26408 for (size_t n = 0; n < ret_var.datalen; n++) {
26409 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
26410 *ret_conv_39_conv = ret_var.data[n];
26411 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
26413 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26414 FREE(ret_var.data);
26418 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
26419 LDKChannelMonitor this_arg_conv;
26420 this_arg_conv.inner = (void*)(this_arg & (~1));
26421 this_arg_conv.is_owned = false;
26422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26423 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
26424 jobjectArray ret_arr = NULL;
26425 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
26427 for (size_t i = 0; i < ret_var.datalen; i++) {
26428 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
26429 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
26430 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
26433 FREE(ret_var.data);
26437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
26438 LDKChannelMonitor this_arg_conv;
26439 this_arg_conv.inner = (void*)(this_arg & (~1));
26440 this_arg_conv.is_owned = false;
26441 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26442 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
26443 int64_t ret_ref = 0;
26444 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26445 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26447 ret_ref = (uintptr_t)ret_var.inner;
26448 if (ret_var.is_owned) {
26454 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
26455 LDKChannelMonitor this_arg_conv;
26456 this_arg_conv.inner = (void*)(this_arg & (~1));
26457 this_arg_conv.is_owned = false;
26458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26459 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
26460 int64_tArray ret_arr = NULL;
26461 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26462 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26463 for (size_t j = 0; j < ret_var.datalen; j++) {
26464 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26465 *ret_conv_9_copy = ret_var.data[j];
26466 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
26467 ret_arr_ptr[j] = ret_conv_9_ref;
26469 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26470 FREE(ret_var.data);
26474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
26475 LDKu8slice ser_ref;
26476 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26477 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26478 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
26479 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
26480 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
26481 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
26482 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
26483 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26484 return (int64_t)ret_conv;
26487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26488 LDKOutPoint this_obj_conv;
26489 this_obj_conv.inner = (void*)(this_obj & (~1));
26490 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26492 OutPoint_free(this_obj_conv);
26495 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
26496 LDKOutPoint this_ptr_conv;
26497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26498 this_ptr_conv.is_owned = false;
26499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26500 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26501 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
26505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26506 LDKOutPoint this_ptr_conv;
26507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26508 this_ptr_conv.is_owned = false;
26509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26510 LDKThirtyTwoBytes val_ref;
26511 CHECK((*env)->GetArrayLength(env, val) == 32);
26512 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26513 OutPoint_set_txid(&this_ptr_conv, val_ref);
26516 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
26517 LDKOutPoint this_ptr_conv;
26518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26519 this_ptr_conv.is_owned = false;
26520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26521 int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
26525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26526 LDKOutPoint this_ptr_conv;
26527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26528 this_ptr_conv.is_owned = false;
26529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26530 OutPoint_set_index(&this_ptr_conv, val);
26533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
26534 LDKThirtyTwoBytes txid_arg_ref;
26535 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
26536 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
26537 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
26538 int64_t ret_ref = 0;
26539 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26540 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26541 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26542 ret_ref = (uintptr_t)ret_var.inner;
26543 if (ret_var.is_owned) {
26549 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
26550 LDKOutPoint ret_var = OutPoint_clone(arg);
26551 int64_t ret_ref = 0;
26552 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26553 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26554 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26555 ret_ref = (uintptr_t)ret_var.inner;
26556 if (ret_var.is_owned) {
26561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26562 LDKOutPoint arg_conv;
26563 arg_conv.inner = (void*)(arg & (~1));
26564 arg_conv.is_owned = false;
26565 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26566 int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
26570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26571 LDKOutPoint orig_conv;
26572 orig_conv.inner = (void*)(orig & (~1));
26573 orig_conv.is_owned = false;
26574 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26575 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
26576 int64_t ret_ref = 0;
26577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26580 ret_ref = (uintptr_t)ret_var.inner;
26581 if (ret_var.is_owned) {
26587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26588 LDKOutPoint a_conv;
26589 a_conv.inner = (void*)(a & (~1));
26590 a_conv.is_owned = false;
26591 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26592 LDKOutPoint b_conv;
26593 b_conv.inner = (void*)(b & (~1));
26594 b_conv.is_owned = false;
26595 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26596 jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
26600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
26601 LDKOutPoint o_conv;
26602 o_conv.inner = (void*)(o & (~1));
26603 o_conv.is_owned = false;
26604 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26605 int64_t ret_conv = OutPoint_hash(&o_conv);
26609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26610 LDKOutPoint this_arg_conv;
26611 this_arg_conv.inner = (void*)(this_arg & (~1));
26612 this_arg_conv.is_owned = false;
26613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26614 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26615 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
26619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
26620 LDKOutPoint obj_conv;
26621 obj_conv.inner = (void*)(obj & (~1));
26622 obj_conv.is_owned = false;
26623 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26624 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
26625 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26626 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26627 CVec_u8Z_free(ret_var);
26631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26632 LDKu8slice ser_ref;
26633 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26634 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26635 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
26636 *ret_conv = OutPoint_read(ser_ref);
26637 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26638 return (int64_t)ret_conv;
26641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26642 LDKDelayedPaymentOutputDescriptor this_obj_conv;
26643 this_obj_conv.inner = (void*)(this_obj & (~1));
26644 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26646 DelayedPaymentOutputDescriptor_free(this_obj_conv);
26649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26650 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26652 this_ptr_conv.is_owned = false;
26653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26654 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26655 int64_t ret_ref = 0;
26656 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26657 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26658 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26659 ret_ref = (uintptr_t)ret_var.inner;
26660 if (ret_var.is_owned) {
26666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26667 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26669 this_ptr_conv.is_owned = false;
26670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26671 LDKOutPoint val_conv;
26672 val_conv.inner = (void*)(val & (~1));
26673 val_conv.is_owned = (val & 1) || (val == 0);
26674 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26675 val_conv = OutPoint_clone(&val_conv);
26676 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
26680 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26682 this_ptr_conv.is_owned = false;
26683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26684 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26685 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
26689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26690 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26692 this_ptr_conv.is_owned = false;
26693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26694 LDKPublicKey val_ref;
26695 CHECK((*env)->GetArrayLength(env, val) == 33);
26696 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26697 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26700 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26701 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26703 this_ptr_conv.is_owned = false;
26704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26705 int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26710 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26712 this_ptr_conv.is_owned = false;
26713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26714 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26718 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26720 this_ptr_conv.is_owned = false;
26721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26722 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26723 CHECK_ACCESS(val_ptr);
26724 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26725 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
26726 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26730 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26732 this_ptr_conv.is_owned = false;
26733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26734 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26735 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
26739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26740 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26742 this_ptr_conv.is_owned = false;
26743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26744 LDKPublicKey val_ref;
26745 CHECK((*env)->GetArrayLength(env, val) == 33);
26746 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26747 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26751 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26753 this_ptr_conv.is_owned = false;
26754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26755 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26756 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
26760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26761 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26763 this_ptr_conv.is_owned = false;
26764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26765 LDKThirtyTwoBytes val_ref;
26766 CHECK((*env)->GetArrayLength(env, val) == 32);
26767 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26768 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26772 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26774 this_ptr_conv.is_owned = false;
26775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26776 int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26781 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26783 this_ptr_conv.is_owned = false;
26784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26785 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26788 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) {
26789 LDKOutPoint outpoint_arg_conv;
26790 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26791 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26792 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26793 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26794 LDKPublicKey per_commitment_point_arg_ref;
26795 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
26796 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
26797 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
26798 CHECK_ACCESS(output_arg_ptr);
26799 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26800 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
26801 LDKPublicKey revocation_pubkey_arg_ref;
26802 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
26803 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
26804 LDKThirtyTwoBytes channel_keys_id_arg_ref;
26805 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
26806 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
26807 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);
26808 int64_t ret_ref = 0;
26809 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26810 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26811 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26812 ret_ref = (uintptr_t)ret_var.inner;
26813 if (ret_var.is_owned) {
26819 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26820 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26821 int64_t ret_ref = 0;
26822 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26823 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26824 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26825 ret_ref = (uintptr_t)ret_var.inner;
26826 if (ret_var.is_owned) {
26831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26832 LDKDelayedPaymentOutputDescriptor arg_conv;
26833 arg_conv.inner = (void*)(arg & (~1));
26834 arg_conv.is_owned = false;
26835 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26836 int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
26840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26841 LDKDelayedPaymentOutputDescriptor orig_conv;
26842 orig_conv.inner = (void*)(orig & (~1));
26843 orig_conv.is_owned = false;
26844 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26845 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
26846 int64_t ret_ref = 0;
26847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26850 ret_ref = (uintptr_t)ret_var.inner;
26851 if (ret_var.is_owned) {
26857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26858 LDKDelayedPaymentOutputDescriptor obj_conv;
26859 obj_conv.inner = (void*)(obj & (~1));
26860 obj_conv.is_owned = false;
26861 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26862 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26863 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26864 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26865 CVec_u8Z_free(ret_var);
26869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26870 LDKu8slice ser_ref;
26871 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26872 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26873 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26874 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26875 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26876 return (int64_t)ret_conv;
26879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26880 LDKStaticPaymentOutputDescriptor this_obj_conv;
26881 this_obj_conv.inner = (void*)(this_obj & (~1));
26882 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26883 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26884 StaticPaymentOutputDescriptor_free(this_obj_conv);
26887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26888 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26890 this_ptr_conv.is_owned = false;
26891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26892 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26893 int64_t ret_ref = 0;
26894 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26895 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26897 ret_ref = (uintptr_t)ret_var.inner;
26898 if (ret_var.is_owned) {
26904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26905 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26907 this_ptr_conv.is_owned = false;
26908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26909 LDKOutPoint val_conv;
26910 val_conv.inner = (void*)(val & (~1));
26911 val_conv.is_owned = (val & 1) || (val == 0);
26912 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26913 val_conv = OutPoint_clone(&val_conv);
26914 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26918 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26920 this_ptr_conv.is_owned = false;
26921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26922 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26923 CHECK_ACCESS(val_ptr);
26924 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26925 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
26926 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26929 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26930 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26932 this_ptr_conv.is_owned = false;
26933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26934 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26935 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
26939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26940 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26942 this_ptr_conv.is_owned = false;
26943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26944 LDKThirtyTwoBytes val_ref;
26945 CHECK((*env)->GetArrayLength(env, val) == 32);
26946 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26947 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26951 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26953 this_ptr_conv.is_owned = false;
26954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26955 int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26960 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26962 this_ptr_conv.is_owned = false;
26963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26964 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26967 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) {
26968 LDKOutPoint outpoint_arg_conv;
26969 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26970 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26971 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26972 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26973 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
26974 CHECK_ACCESS(output_arg_ptr);
26975 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26976 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
26977 LDKThirtyTwoBytes channel_keys_id_arg_ref;
26978 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
26979 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
26980 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26981 int64_t ret_ref = 0;
26982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26985 ret_ref = (uintptr_t)ret_var.inner;
26986 if (ret_var.is_owned) {
26992 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26993 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26994 int64_t ret_ref = 0;
26995 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26996 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26998 ret_ref = (uintptr_t)ret_var.inner;
26999 if (ret_var.is_owned) {
27004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27005 LDKStaticPaymentOutputDescriptor arg_conv;
27006 arg_conv.inner = (void*)(arg & (~1));
27007 arg_conv.is_owned = false;
27008 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27009 int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
27013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27014 LDKStaticPaymentOutputDescriptor orig_conv;
27015 orig_conv.inner = (void*)(orig & (~1));
27016 orig_conv.is_owned = false;
27017 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27018 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
27019 int64_t ret_ref = 0;
27020 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27021 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27022 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27023 ret_ref = (uintptr_t)ret_var.inner;
27024 if (ret_var.is_owned) {
27030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27031 LDKStaticPaymentOutputDescriptor obj_conv;
27032 obj_conv.inner = (void*)(obj & (~1));
27033 obj_conv.is_owned = false;
27034 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27035 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
27036 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27037 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27038 CVec_u8Z_free(ret_var);
27042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27043 LDKu8slice ser_ref;
27044 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27045 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27046 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
27047 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
27048 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27049 return (int64_t)ret_conv;
27052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27053 if ((this_ptr & 1) != 0) return;
27054 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27055 CHECK_ACCESS(this_ptr_ptr);
27056 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
27057 FREE((void*)this_ptr);
27058 SpendableOutputDescriptor_free(this_ptr_conv);
27061 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
27062 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27063 *ret_copy = SpendableOutputDescriptor_clone(arg);
27064 int64_t ret_ref = (uintptr_t)ret_copy;
27067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27068 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
27069 int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
27073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27074 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
27075 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27076 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
27077 int64_t ret_ref = (uintptr_t)ret_copy;
27081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
27082 LDKOutPoint outpoint_conv;
27083 outpoint_conv.inner = (void*)(outpoint & (~1));
27084 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
27085 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
27086 outpoint_conv = OutPoint_clone(&outpoint_conv);
27087 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
27088 CHECK_ACCESS(output_ptr);
27089 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
27090 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
27091 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27092 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
27093 int64_t ret_ref = (uintptr_t)ret_copy;
27097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27098 LDKDelayedPaymentOutputDescriptor a_conv;
27099 a_conv.inner = (void*)(a & (~1));
27100 a_conv.is_owned = (a & 1) || (a == 0);
27101 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27102 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
27103 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27104 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
27105 int64_t ret_ref = (uintptr_t)ret_copy;
27109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
27110 LDKStaticPaymentOutputDescriptor a_conv;
27111 a_conv.inner = (void*)(a & (~1));
27112 a_conv.is_owned = (a & 1) || (a == 0);
27113 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27114 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
27115 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
27116 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
27117 int64_t ret_ref = (uintptr_t)ret_copy;
27121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
27122 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
27123 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
27124 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27125 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27126 CVec_u8Z_free(ret_var);
27130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27131 LDKu8slice ser_ref;
27132 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27133 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27134 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
27135 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
27136 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27137 return (int64_t)ret_conv;
27140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27141 if ((this_ptr & 1) != 0) return;
27142 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27143 CHECK_ACCESS(this_ptr_ptr);
27144 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
27145 FREE((void*)this_ptr);
27146 BaseSign_free(this_ptr_conv);
27149 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
27150 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27151 *ret_ret = Sign_clone(arg);
27152 return (int64_t)ret_ret;
27154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27155 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
27156 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
27157 LDKSign* arg_conv = (LDKSign*)arg_ptr;
27158 int64_t ret_conv = Sign_clone_ptr(arg_conv);
27162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27163 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
27164 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
27165 LDKSign* orig_conv = (LDKSign*)orig_ptr;
27166 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27167 *ret_ret = Sign_clone(orig_conv);
27168 return (int64_t)ret_ret;
27171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27172 if ((this_ptr & 1) != 0) return;
27173 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27174 CHECK_ACCESS(this_ptr_ptr);
27175 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
27176 FREE((void*)this_ptr);
27177 Sign_free(this_ptr_conv);
27180 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27181 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
27182 jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
27186 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
27187 jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
27191 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
27192 jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
27196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27197 if ((this_ptr & 1) != 0) return;
27198 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
27199 CHECK_ACCESS(this_ptr_ptr);
27200 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
27201 FREE((void*)this_ptr);
27202 KeysInterface_free(this_ptr_conv);
27205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27206 LDKInMemorySigner this_obj_conv;
27207 this_obj_conv.inner = (void*)(this_obj & (~1));
27208 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27210 InMemorySigner_free(this_obj_conv);
27213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27214 LDKInMemorySigner this_ptr_conv;
27215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27216 this_ptr_conv.is_owned = false;
27217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27218 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27219 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
27223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27224 LDKInMemorySigner this_ptr_conv;
27225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27226 this_ptr_conv.is_owned = false;
27227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27228 LDKSecretKey val_ref;
27229 CHECK((*env)->GetArrayLength(env, val) == 32);
27230 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27231 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
27234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27235 LDKInMemorySigner this_ptr_conv;
27236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27237 this_ptr_conv.is_owned = false;
27238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27239 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27240 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
27244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27245 LDKInMemorySigner this_ptr_conv;
27246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27247 this_ptr_conv.is_owned = false;
27248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27249 LDKSecretKey val_ref;
27250 CHECK((*env)->GetArrayLength(env, val) == 32);
27251 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27252 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
27255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27256 LDKInMemorySigner this_ptr_conv;
27257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27258 this_ptr_conv.is_owned = false;
27259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27260 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27261 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
27265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27266 LDKInMemorySigner this_ptr_conv;
27267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27268 this_ptr_conv.is_owned = false;
27269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27270 LDKSecretKey val_ref;
27271 CHECK((*env)->GetArrayLength(env, val) == 32);
27272 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27273 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
27276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27277 LDKInMemorySigner this_ptr_conv;
27278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27279 this_ptr_conv.is_owned = false;
27280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27281 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27282 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
27286 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) {
27287 LDKInMemorySigner 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 LDKSecretKey val_ref;
27292 CHECK((*env)->GetArrayLength(env, val) == 32);
27293 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27294 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
27297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
27298 LDKInMemorySigner this_ptr_conv;
27299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27300 this_ptr_conv.is_owned = false;
27301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27302 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27303 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
27307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27308 LDKInMemorySigner this_ptr_conv;
27309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27310 this_ptr_conv.is_owned = false;
27311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27312 LDKSecretKey val_ref;
27313 CHECK((*env)->GetArrayLength(env, val) == 32);
27314 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
27315 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
27318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
27319 LDKInMemorySigner this_ptr_conv;
27320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27321 this_ptr_conv.is_owned = false;
27322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27323 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27324 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
27328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27329 LDKInMemorySigner this_ptr_conv;
27330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27331 this_ptr_conv.is_owned = false;
27332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27333 LDKThirtyTwoBytes val_ref;
27334 CHECK((*env)->GetArrayLength(env, val) == 32);
27335 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27336 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
27339 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
27340 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
27341 int64_t ret_ref = 0;
27342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27345 ret_ref = (uintptr_t)ret_var.inner;
27346 if (ret_var.is_owned) {
27351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27352 LDKInMemorySigner arg_conv;
27353 arg_conv.inner = (void*)(arg & (~1));
27354 arg_conv.is_owned = false;
27355 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27356 int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
27360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27361 LDKInMemorySigner orig_conv;
27362 orig_conv.inner = (void*)(orig & (~1));
27363 orig_conv.is_owned = false;
27364 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27365 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
27366 int64_t ret_ref = 0;
27367 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27368 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27370 ret_ref = (uintptr_t)ret_var.inner;
27371 if (ret_var.is_owned) {
27377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray node_secret, 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) {
27378 LDKSecretKey node_secret_ref;
27379 CHECK((*env)->GetArrayLength(env, node_secret) == 32);
27380 (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
27381 LDKSecretKey funding_key_ref;
27382 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
27383 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
27384 LDKSecretKey revocation_base_key_ref;
27385 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
27386 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
27387 LDKSecretKey payment_key_ref;
27388 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
27389 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
27390 LDKSecretKey delayed_payment_base_key_ref;
27391 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
27392 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
27393 LDKSecretKey htlc_base_key_ref;
27394 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
27395 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
27396 LDKThirtyTwoBytes commitment_seed_ref;
27397 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
27398 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
27399 LDKThirtyTwoBytes channel_keys_id_ref;
27400 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
27401 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
27402 LDKInMemorySigner ret_var = InMemorySigner_new(node_secret_ref, 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);
27403 int64_t ret_ref = 0;
27404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27407 ret_ref = (uintptr_t)ret_var.inner;
27408 if (ret_var.is_owned) {
27414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
27415 LDKInMemorySigner this_arg_conv;
27416 this_arg_conv.inner = (void*)(this_arg & (~1));
27417 this_arg_conv.is_owned = false;
27418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27419 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
27420 int64_t ret_ref = 0;
27421 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27422 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27424 ret_ref = (uintptr_t)ret_var.inner;
27425 if (ret_var.is_owned) {
27431 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27432 LDKInMemorySigner this_arg_conv;
27433 this_arg_conv.inner = (void*)(this_arg & (~1));
27434 this_arg_conv.is_owned = false;
27435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27436 int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
27440 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27441 LDKInMemorySigner this_arg_conv;
27442 this_arg_conv.inner = (void*)(this_arg & (~1));
27443 this_arg_conv.is_owned = false;
27444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27445 int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
27449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
27450 LDKInMemorySigner this_arg_conv;
27451 this_arg_conv.inner = (void*)(this_arg & (~1));
27452 this_arg_conv.is_owned = false;
27453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27454 jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
27458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
27459 LDKInMemorySigner this_arg_conv;
27460 this_arg_conv.inner = (void*)(this_arg & (~1));
27461 this_arg_conv.is_owned = false;
27462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27463 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
27464 int64_t ret_ref = 0;
27465 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27466 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27467 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27468 ret_ref = (uintptr_t)ret_var.inner;
27469 if (ret_var.is_owned) {
27475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
27476 LDKInMemorySigner this_arg_conv;
27477 this_arg_conv.inner = (void*)(this_arg & (~1));
27478 this_arg_conv.is_owned = false;
27479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27480 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
27481 int64_t ret_ref = 0;
27482 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27483 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27485 ret_ref = (uintptr_t)ret_var.inner;
27486 if (ret_var.is_owned) {
27492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
27493 LDKInMemorySigner this_arg_conv;
27494 this_arg_conv.inner = (void*)(this_arg & (~1));
27495 this_arg_conv.is_owned = false;
27496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27497 jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
27501 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) {
27502 LDKInMemorySigner this_arg_conv;
27503 this_arg_conv.inner = (void*)(this_arg & (~1));
27504 this_arg_conv.is_owned = false;
27505 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27506 LDKTransaction spend_tx_ref;
27507 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27508 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27509 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27510 spend_tx_ref.data_is_owned = true;
27511 LDKStaticPaymentOutputDescriptor descriptor_conv;
27512 descriptor_conv.inner = (void*)(descriptor & (~1));
27513 descriptor_conv.is_owned = false;
27514 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27515 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27516 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27517 return (int64_t)ret_conv;
27520 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) {
27521 LDKInMemorySigner this_arg_conv;
27522 this_arg_conv.inner = (void*)(this_arg & (~1));
27523 this_arg_conv.is_owned = false;
27524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27525 LDKTransaction spend_tx_ref;
27526 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27527 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27528 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27529 spend_tx_ref.data_is_owned = true;
27530 LDKDelayedPaymentOutputDescriptor descriptor_conv;
27531 descriptor_conv.inner = (void*)(descriptor & (~1));
27532 descriptor_conv.is_owned = false;
27533 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27534 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27535 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27536 return (int64_t)ret_conv;
27539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
27540 LDKInMemorySigner this_arg_conv;
27541 this_arg_conv.inner = (void*)(this_arg & (~1));
27542 this_arg_conv.is_owned = false;
27543 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27544 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
27545 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
27546 return (int64_t)ret_ret;
27549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
27550 LDKInMemorySigner this_arg_conv;
27551 this_arg_conv.inner = (void*)(this_arg & (~1));
27552 this_arg_conv.is_owned = false;
27553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27554 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27555 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
27556 return (int64_t)ret_ret;
27559 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
27560 LDKInMemorySigner obj_conv;
27561 obj_conv.inner = (void*)(obj & (~1));
27562 obj_conv.is_owned = false;
27563 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27564 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27565 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27566 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27567 CVec_u8Z_free(ret_var);
27571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
27572 LDKu8slice ser_ref;
27573 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27574 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27575 LDKSecretKey arg_ref;
27576 CHECK((*env)->GetArrayLength(env, arg) == 32);
27577 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
27578 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27579 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
27580 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27581 return (int64_t)ret_conv;
27584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27585 LDKKeysManager this_obj_conv;
27586 this_obj_conv.inner = (void*)(this_obj & (~1));
27587 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27589 KeysManager_free(this_obj_conv);
27592 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) {
27593 unsigned char seed_arr[32];
27594 CHECK((*env)->GetArrayLength(env, seed) == 32);
27595 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27596 unsigned char (*seed_ref)[32] = &seed_arr;
27597 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27598 int64_t ret_ref = 0;
27599 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27600 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27601 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27602 ret_ref = (uintptr_t)ret_var.inner;
27603 if (ret_var.is_owned) {
27609 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) {
27610 LDKKeysManager this_arg_conv;
27611 this_arg_conv.inner = (void*)(this_arg & (~1));
27612 this_arg_conv.is_owned = false;
27613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27614 unsigned char params_arr[32];
27615 CHECK((*env)->GetArrayLength(env, params) == 32);
27616 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27617 unsigned char (*params_ref)[32] = ¶ms_arr;
27618 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27619 int64_t ret_ref = 0;
27620 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27621 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27622 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27623 ret_ref = (uintptr_t)ret_var.inner;
27624 if (ret_var.is_owned) {
27630 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) {
27631 LDKKeysManager this_arg_conv;
27632 this_arg_conv.inner = (void*)(this_arg & (~1));
27633 this_arg_conv.is_owned = false;
27634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27635 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27636 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
27637 if (descriptors_constr.datalen > 0)
27638 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27640 descriptors_constr.data = NULL;
27641 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
27642 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27643 int64_t descriptors_conv_27 = descriptors_vals[b];
27644 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
27645 CHECK_ACCESS(descriptors_conv_27_ptr);
27646 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27647 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
27648 descriptors_constr.data[b] = descriptors_conv_27_conv;
27650 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
27651 LDKCVec_TxOutZ outputs_constr;
27652 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
27653 if (outputs_constr.datalen > 0)
27654 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27656 outputs_constr.data = NULL;
27657 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
27658 for (size_t h = 0; h < outputs_constr.datalen; h++) {
27659 int64_t outputs_conv_7 = outputs_vals[h];
27660 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
27661 CHECK_ACCESS(outputs_conv_7_ptr);
27662 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27663 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
27664 outputs_constr.data[h] = outputs_conv_7_conv;
27666 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
27667 LDKCVec_u8Z change_destination_script_ref;
27668 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
27669 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27670 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
27671 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27672 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27673 return (int64_t)ret_conv;
27676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
27677 LDKKeysManager this_arg_conv;
27678 this_arg_conv.inner = (void*)(this_arg & (~1));
27679 this_arg_conv.is_owned = false;
27680 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27681 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
27682 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
27683 return (int64_t)ret_ret;
27686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27687 LDKPhantomKeysManager this_obj_conv;
27688 this_obj_conv.inner = (void*)(this_obj & (~1));
27689 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27691 PhantomKeysManager_free(this_obj_conv);
27694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
27695 LDKPhantomKeysManager this_arg_conv;
27696 this_arg_conv.inner = (void*)(this_arg & (~1));
27697 this_arg_conv.is_owned = false;
27698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27699 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
27700 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
27701 return (int64_t)ret_ret;
27704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) {
27705 unsigned char seed_arr[32];
27706 CHECK((*env)->GetArrayLength(env, seed) == 32);
27707 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27708 unsigned char (*seed_ref)[32] = &seed_arr;
27709 unsigned char cross_node_seed_arr[32];
27710 CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
27711 (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
27712 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27713 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27714 int64_t ret_ref = 0;
27715 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27716 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27718 ret_ref = (uintptr_t)ret_var.inner;
27719 if (ret_var.is_owned) {
27725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_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) {
27726 LDKPhantomKeysManager this_arg_conv;
27727 this_arg_conv.inner = (void*)(this_arg & (~1));
27728 this_arg_conv.is_owned = false;
27729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27730 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27731 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
27732 if (descriptors_constr.datalen > 0)
27733 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27735 descriptors_constr.data = NULL;
27736 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
27737 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27738 int64_t descriptors_conv_27 = descriptors_vals[b];
27739 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
27740 CHECK_ACCESS(descriptors_conv_27_ptr);
27741 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27742 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
27743 descriptors_constr.data[b] = descriptors_conv_27_conv;
27745 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
27746 LDKCVec_TxOutZ outputs_constr;
27747 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
27748 if (outputs_constr.datalen > 0)
27749 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27751 outputs_constr.data = NULL;
27752 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
27753 for (size_t h = 0; h < outputs_constr.datalen; h++) {
27754 int64_t outputs_conv_7 = outputs_vals[h];
27755 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
27756 CHECK_ACCESS(outputs_conv_7_ptr);
27757 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27758 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
27759 outputs_constr.data[h] = outputs_conv_7_conv;
27761 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
27762 LDKCVec_u8Z change_destination_script_ref;
27763 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
27764 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27765 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
27766 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27767 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27768 return (int64_t)ret_conv;
27771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) {
27772 LDKPhantomKeysManager this_arg_conv;
27773 this_arg_conv.inner = (void*)(this_arg & (~1));
27774 this_arg_conv.is_owned = false;
27775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27776 unsigned char params_arr[32];
27777 CHECK((*env)->GetArrayLength(env, params) == 32);
27778 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27779 unsigned char (*params_ref)[32] = ¶ms_arr;
27780 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27781 int64_t ret_ref = 0;
27782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27785 ret_ref = (uintptr_t)ret_var.inner;
27786 if (ret_var.is_owned) {
27792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27793 LDKChannelManager this_obj_conv;
27794 this_obj_conv.inner = (void*)(this_obj & (~1));
27795 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27797 ChannelManager_free(this_obj_conv);
27800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27801 LDKChainParameters this_obj_conv;
27802 this_obj_conv.inner = (void*)(this_obj & (~1));
27803 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27805 ChainParameters_free(this_obj_conv);
27808 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
27809 LDKChainParameters this_ptr_conv;
27810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27811 this_ptr_conv.is_owned = false;
27812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27813 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
27817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
27818 LDKChainParameters this_ptr_conv;
27819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27820 this_ptr_conv.is_owned = false;
27821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27822 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
27823 ChainParameters_set_network(&this_ptr_conv, val_conv);
27826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
27827 LDKChainParameters this_ptr_conv;
27828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27829 this_ptr_conv.is_owned = false;
27830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27831 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27832 int64_t ret_ref = 0;
27833 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27834 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27835 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27836 ret_ref = (uintptr_t)ret_var.inner;
27837 if (ret_var.is_owned) {
27843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27844 LDKChainParameters this_ptr_conv;
27845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27846 this_ptr_conv.is_owned = false;
27847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27848 LDKBestBlock val_conv;
27849 val_conv.inner = (void*)(val & (~1));
27850 val_conv.is_owned = (val & 1) || (val == 0);
27851 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27852 val_conv = BestBlock_clone(&val_conv);
27853 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
27857 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
27858 LDKBestBlock best_block_arg_conv;
27859 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
27860 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
27861 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27862 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27863 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27864 int64_t ret_ref = 0;
27865 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27866 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27867 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27868 ret_ref = (uintptr_t)ret_var.inner;
27869 if (ret_var.is_owned) {
27875 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27876 LDKChainParameters ret_var = ChainParameters_clone(arg);
27877 int64_t ret_ref = 0;
27878 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27879 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27881 ret_ref = (uintptr_t)ret_var.inner;
27882 if (ret_var.is_owned) {
27887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27888 LDKChainParameters arg_conv;
27889 arg_conv.inner = (void*)(arg & (~1));
27890 arg_conv.is_owned = false;
27891 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27892 int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
27896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27897 LDKChainParameters orig_conv;
27898 orig_conv.inner = (void*)(orig & (~1));
27899 orig_conv.is_owned = false;
27900 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27901 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27902 int64_t ret_ref = 0;
27903 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27904 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27906 ret_ref = (uintptr_t)ret_var.inner;
27907 if (ret_var.is_owned) {
27913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27914 LDKCounterpartyForwardingInfo this_obj_conv;
27915 this_obj_conv.inner = (void*)(this_obj & (~1));
27916 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27918 CounterpartyForwardingInfo_free(this_obj_conv);
27921 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27922 LDKCounterpartyForwardingInfo this_ptr_conv;
27923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27924 this_ptr_conv.is_owned = false;
27925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27926 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27931 LDKCounterpartyForwardingInfo this_ptr_conv;
27932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27933 this_ptr_conv.is_owned = false;
27934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27935 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27938 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
27939 LDKCounterpartyForwardingInfo this_ptr_conv;
27940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27941 this_ptr_conv.is_owned = false;
27942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27943 int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27948 LDKCounterpartyForwardingInfo this_ptr_conv;
27949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27950 this_ptr_conv.is_owned = false;
27951 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27952 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27955 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
27956 LDKCounterpartyForwardingInfo this_ptr_conv;
27957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27958 this_ptr_conv.is_owned = false;
27959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27960 int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27965 LDKCounterpartyForwardingInfo this_ptr_conv;
27966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27967 this_ptr_conv.is_owned = false;
27968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27969 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27972 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) {
27973 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27974 int64_t ret_ref = 0;
27975 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27976 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27978 ret_ref = (uintptr_t)ret_var.inner;
27979 if (ret_var.is_owned) {
27985 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27986 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27987 int64_t ret_ref = 0;
27988 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27989 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27991 ret_ref = (uintptr_t)ret_var.inner;
27992 if (ret_var.is_owned) {
27997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27998 LDKCounterpartyForwardingInfo arg_conv;
27999 arg_conv.inner = (void*)(arg & (~1));
28000 arg_conv.is_owned = false;
28001 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28002 int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
28006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28007 LDKCounterpartyForwardingInfo orig_conv;
28008 orig_conv.inner = (void*)(orig & (~1));
28009 orig_conv.is_owned = false;
28010 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28011 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
28012 int64_t ret_ref = 0;
28013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28016 ret_ref = (uintptr_t)ret_var.inner;
28017 if (ret_var.is_owned) {
28023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28024 LDKChannelCounterparty this_obj_conv;
28025 this_obj_conv.inner = (void*)(this_obj & (~1));
28026 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28028 ChannelCounterparty_free(this_obj_conv);
28031 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28032 LDKChannelCounterparty this_ptr_conv;
28033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28034 this_ptr_conv.is_owned = false;
28035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28036 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28037 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
28041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28042 LDKChannelCounterparty this_ptr_conv;
28043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28044 this_ptr_conv.is_owned = false;
28045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28046 LDKPublicKey val_ref;
28047 CHECK((*env)->GetArrayLength(env, val) == 33);
28048 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28049 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
28052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
28053 LDKChannelCounterparty this_ptr_conv;
28054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28055 this_ptr_conv.is_owned = false;
28056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28057 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
28058 int64_t ret_ref = 0;
28059 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28060 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28062 ret_ref = (uintptr_t)ret_var.inner;
28063 if (ret_var.is_owned) {
28069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28070 LDKChannelCounterparty this_ptr_conv;
28071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28072 this_ptr_conv.is_owned = false;
28073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28074 LDKInitFeatures val_conv;
28075 val_conv.inner = (void*)(val & (~1));
28076 val_conv.is_owned = (val & 1) || (val == 0);
28077 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28078 val_conv = InitFeatures_clone(&val_conv);
28079 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
28082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28083 LDKChannelCounterparty this_ptr_conv;
28084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28085 this_ptr_conv.is_owned = false;
28086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28087 int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
28091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28092 LDKChannelCounterparty this_ptr_conv;
28093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28094 this_ptr_conv.is_owned = false;
28095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28096 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
28099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28100 LDKChannelCounterparty this_ptr_conv;
28101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28102 this_ptr_conv.is_owned = false;
28103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28104 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
28105 int64_t ret_ref = 0;
28106 if ((uintptr_t)ret_var.inner > 4096) {
28107 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28108 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28109 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28110 ret_ref = (uintptr_t)ret_var.inner;
28111 if (ret_var.is_owned) {
28118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28119 LDKChannelCounterparty this_ptr_conv;
28120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28121 this_ptr_conv.is_owned = false;
28122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28123 LDKCounterpartyForwardingInfo val_conv;
28124 val_conv.inner = (void*)(val & (~1));
28125 val_conv.is_owned = (val & 1) || (val == 0);
28126 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28127 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
28128 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
28131 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) {
28132 LDKPublicKey node_id_arg_ref;
28133 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
28134 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
28135 LDKInitFeatures features_arg_conv;
28136 features_arg_conv.inner = (void*)(features_arg & (~1));
28137 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
28138 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28139 features_arg_conv = InitFeatures_clone(&features_arg_conv);
28140 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
28141 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
28142 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
28143 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
28144 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
28145 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
28146 int64_t ret_ref = 0;
28147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28150 ret_ref = (uintptr_t)ret_var.inner;
28151 if (ret_var.is_owned) {
28157 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
28158 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
28159 int64_t ret_ref = 0;
28160 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28161 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
28164 if (ret_var.is_owned) {
28169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28170 LDKChannelCounterparty arg_conv;
28171 arg_conv.inner = (void*)(arg & (~1));
28172 arg_conv.is_owned = false;
28173 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28174 int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
28178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28179 LDKChannelCounterparty orig_conv;
28180 orig_conv.inner = (void*)(orig & (~1));
28181 orig_conv.is_owned = false;
28182 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28183 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
28184 int64_t ret_ref = 0;
28185 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28186 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28188 ret_ref = (uintptr_t)ret_var.inner;
28189 if (ret_var.is_owned) {
28195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28196 LDKChannelDetails this_obj_conv;
28197 this_obj_conv.inner = (void*)(this_obj & (~1));
28198 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28200 ChannelDetails_free(this_obj_conv);
28203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28204 LDKChannelDetails this_ptr_conv;
28205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28206 this_ptr_conv.is_owned = false;
28207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28208 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
28209 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
28213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28214 LDKChannelDetails this_ptr_conv;
28215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28216 this_ptr_conv.is_owned = false;
28217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28218 LDKThirtyTwoBytes val_ref;
28219 CHECK((*env)->GetArrayLength(env, val) == 32);
28220 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
28221 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
28224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
28225 LDKChannelDetails this_ptr_conv;
28226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28227 this_ptr_conv.is_owned = false;
28228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28229 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
28230 int64_t ret_ref = 0;
28231 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28232 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28234 ret_ref = (uintptr_t)ret_var.inner;
28235 if (ret_var.is_owned) {
28241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28242 LDKChannelDetails this_ptr_conv;
28243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28244 this_ptr_conv.is_owned = false;
28245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28246 LDKChannelCounterparty val_conv;
28247 val_conv.inner = (void*)(val & (~1));
28248 val_conv.is_owned = (val & 1) || (val == 0);
28249 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28250 val_conv = ChannelCounterparty_clone(&val_conv);
28251 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
28254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
28255 LDKChannelDetails this_ptr_conv;
28256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28257 this_ptr_conv.is_owned = false;
28258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28259 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
28260 int64_t ret_ref = 0;
28261 if ((uintptr_t)ret_var.inner > 4096) {
28262 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28263 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28264 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28265 ret_ref = (uintptr_t)ret_var.inner;
28266 if (ret_var.is_owned) {
28273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28274 LDKChannelDetails this_ptr_conv;
28275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28276 this_ptr_conv.is_owned = false;
28277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28278 LDKOutPoint val_conv;
28279 val_conv.inner = (void*)(val & (~1));
28280 val_conv.is_owned = (val & 1) || (val == 0);
28281 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28282 val_conv = OutPoint_clone(&val_conv);
28283 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
28286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
28287 LDKChannelDetails this_ptr_conv;
28288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28289 this_ptr_conv.is_owned = false;
28290 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28291 LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
28292 int64_t ret_ref = 0;
28293 if ((uintptr_t)ret_var.inner > 4096) {
28294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28297 ret_ref = (uintptr_t)ret_var.inner;
28298 if (ret_var.is_owned) {
28305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28306 LDKChannelDetails this_ptr_conv;
28307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28308 this_ptr_conv.is_owned = false;
28309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28310 LDKChannelTypeFeatures val_conv;
28311 val_conv.inner = (void*)(val & (~1));
28312 val_conv.is_owned = (val & 1) || (val == 0);
28313 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28314 val_conv = ChannelTypeFeatures_clone(&val_conv);
28315 ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
28318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28319 LDKChannelDetails this_ptr_conv;
28320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28321 this_ptr_conv.is_owned = false;
28322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28323 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28324 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
28325 int64_t ret_ref = (uintptr_t)ret_copy;
28329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28330 LDKChannelDetails this_ptr_conv;
28331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28332 this_ptr_conv.is_owned = false;
28333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28334 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28335 CHECK_ACCESS(val_ptr);
28336 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28337 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28338 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
28341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
28342 LDKChannelDetails this_ptr_conv;
28343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28344 this_ptr_conv.is_owned = false;
28345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28346 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28347 *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
28348 int64_t ret_ref = (uintptr_t)ret_copy;
28352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28353 LDKChannelDetails this_ptr_conv;
28354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28355 this_ptr_conv.is_owned = false;
28356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28357 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28358 CHECK_ACCESS(val_ptr);
28359 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28360 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28361 ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
28364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
28365 LDKChannelDetails this_ptr_conv;
28366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28367 this_ptr_conv.is_owned = false;
28368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28369 int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
28373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28374 LDKChannelDetails this_ptr_conv;
28375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28376 this_ptr_conv.is_owned = false;
28377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28378 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
28381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
28382 LDKChannelDetails this_ptr_conv;
28383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28384 this_ptr_conv.is_owned = false;
28385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28386 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28387 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
28388 int64_t ret_ref = (uintptr_t)ret_copy;
28392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28393 LDKChannelDetails this_ptr_conv;
28394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28395 this_ptr_conv.is_owned = false;
28396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28397 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28398 CHECK_ACCESS(val_ptr);
28399 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
28400 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
28401 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
28404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
28405 LDKChannelDetails this_ptr_conv;
28406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28407 this_ptr_conv.is_owned = false;
28408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28409 int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
28413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28414 LDKChannelDetails this_ptr_conv;
28415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28416 this_ptr_conv.is_owned = false;
28417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28418 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
28421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28422 LDKChannelDetails this_ptr_conv;
28423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28424 this_ptr_conv.is_owned = false;
28425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28426 int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
28430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28431 LDKChannelDetails this_ptr_conv;
28432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28433 this_ptr_conv.is_owned = false;
28434 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28435 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
28438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28439 LDKChannelDetails this_ptr_conv;
28440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28441 this_ptr_conv.is_owned = false;
28442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28443 int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
28447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28448 LDKChannelDetails this_ptr_conv;
28449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28450 this_ptr_conv.is_owned = false;
28451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28452 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
28455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
28456 LDKChannelDetails this_ptr_conv;
28457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28458 this_ptr_conv.is_owned = false;
28459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28460 int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
28464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28465 LDKChannelDetails this_ptr_conv;
28466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28467 this_ptr_conv.is_owned = false;
28468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28469 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
28472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
28473 LDKChannelDetails this_ptr_conv;
28474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28475 this_ptr_conv.is_owned = false;
28476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28477 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
28478 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
28479 int64_t ret_ref = (uintptr_t)ret_copy;
28483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28484 LDKChannelDetails this_ptr_conv;
28485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28486 this_ptr_conv.is_owned = false;
28487 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28488 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28489 CHECK_ACCESS(val_ptr);
28490 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28491 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
28492 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28496 LDKChannelDetails this_ptr_conv;
28497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28498 this_ptr_conv.is_owned = false;
28499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28500 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28501 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28502 int64_t ret_ref = (uintptr_t)ret_copy;
28506 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) {
28507 LDKChannelDetails this_ptr_conv;
28508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28509 this_ptr_conv.is_owned = false;
28510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28511 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28512 CHECK_ACCESS(val_ptr);
28513 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28514 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
28515 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
28519 LDKChannelDetails this_ptr_conv;
28520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28521 this_ptr_conv.is_owned = false;
28522 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28523 jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
28527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28528 LDKChannelDetails this_ptr_conv;
28529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28530 this_ptr_conv.is_owned = false;
28531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28532 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
28536 LDKChannelDetails this_ptr_conv;
28537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28538 this_ptr_conv.is_owned = false;
28539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28540 jboolean ret_conv = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
28544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28545 LDKChannelDetails this_ptr_conv;
28546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28547 this_ptr_conv.is_owned = false;
28548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28549 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
28552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
28553 LDKChannelDetails 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 jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
28561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28562 LDKChannelDetails this_ptr_conv;
28563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28564 this_ptr_conv.is_owned = false;
28565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28566 ChannelDetails_set_is_usable(&this_ptr_conv, val);
28569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
28570 LDKChannelDetails this_ptr_conv;
28571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28572 this_ptr_conv.is_owned = false;
28573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28574 jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
28578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28579 LDKChannelDetails this_ptr_conv;
28580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28581 this_ptr_conv.is_owned = false;
28582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28583 ChannelDetails_set_is_public(&this_ptr_conv, val);
28586 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 channel_type_arg, int64_t short_channel_id_arg, int64_t inbound_scid_alias_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) {
28587 LDKThirtyTwoBytes channel_id_arg_ref;
28588 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
28589 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
28590 LDKChannelCounterparty counterparty_arg_conv;
28591 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
28592 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
28593 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
28594 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
28595 LDKOutPoint funding_txo_arg_conv;
28596 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
28597 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
28598 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
28599 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
28600 LDKChannelTypeFeatures channel_type_arg_conv;
28601 channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1));
28602 channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0);
28603 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
28604 channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
28605 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
28606 CHECK_ACCESS(short_channel_id_arg_ptr);
28607 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
28608 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
28609 void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1);
28610 CHECK_ACCESS(inbound_scid_alias_arg_ptr);
28611 LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
28612 inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1));
28613 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
28614 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
28615 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
28616 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
28617 CHECK_ACCESS(confirmations_required_arg_ptr);
28618 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
28619 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
28620 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
28621 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
28622 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
28623 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
28624 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, inbound_scid_alias_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);
28625 int64_t ret_ref = 0;
28626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28629 ret_ref = (uintptr_t)ret_var.inner;
28630 if (ret_var.is_owned) {
28636 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
28637 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
28638 int64_t ret_ref = 0;
28639 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28640 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28642 ret_ref = (uintptr_t)ret_var.inner;
28643 if (ret_var.is_owned) {
28648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28649 LDKChannelDetails arg_conv;
28650 arg_conv.inner = (void*)(arg & (~1));
28651 arg_conv.is_owned = false;
28652 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28653 int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
28657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28658 LDKChannelDetails orig_conv;
28659 orig_conv.inner = (void*)(orig & (~1));
28660 orig_conv.is_owned = false;
28661 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28662 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28663 int64_t ret_ref = 0;
28664 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28665 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28666 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28667 ret_ref = (uintptr_t)ret_var.inner;
28668 if (ret_var.is_owned) {
28674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
28675 LDKChannelDetails this_arg_conv;
28676 this_arg_conv.inner = (void*)(this_arg & (~1));
28677 this_arg_conv.is_owned = false;
28678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28679 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28680 *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
28681 int64_t ret_ref = (uintptr_t)ret_copy;
28685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28686 if ((this_ptr & 1) != 0) return;
28687 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28688 CHECK_ACCESS(this_ptr_ptr);
28689 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
28690 FREE((void*)this_ptr);
28691 PaymentSendFailure_free(this_ptr_conv);
28694 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
28695 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28696 *ret_copy = PaymentSendFailure_clone(arg);
28697 int64_t ret_ref = (uintptr_t)ret_copy;
28700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28701 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
28702 int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
28706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28707 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
28708 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28709 *ret_copy = PaymentSendFailure_clone(orig_conv);
28710 int64_t ret_ref = (uintptr_t)ret_copy;
28714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
28715 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
28716 CHECK_ACCESS(a_ptr);
28717 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
28718 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
28719 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28720 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
28721 int64_t ret_ref = (uintptr_t)ret_copy;
28725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
28726 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
28727 a_constr.datalen = (*env)->GetArrayLength(env, a);
28728 if (a_constr.datalen > 0)
28729 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28731 a_constr.data = NULL;
28732 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
28733 for (size_t w = 0; w < a_constr.datalen; w++) {
28734 int64_t a_conv_22 = a_vals[w];
28735 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
28736 CHECK_ACCESS(a_conv_22_ptr);
28737 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
28738 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
28739 a_constr.data[w] = a_conv_22_conv;
28741 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
28742 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28743 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
28744 int64_t ret_ref = (uintptr_t)ret_copy;
28748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
28749 LDKCVec_APIErrorZ a_constr;
28750 a_constr.datalen = (*env)->GetArrayLength(env, a);
28751 if (a_constr.datalen > 0)
28752 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
28754 a_constr.data = NULL;
28755 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
28756 for (size_t k = 0; k < a_constr.datalen; k++) {
28757 int64_t a_conv_10 = a_vals[k];
28758 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
28759 CHECK_ACCESS(a_conv_10_ptr);
28760 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
28761 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
28762 a_constr.data[k] = a_conv_10_conv;
28764 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
28765 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28766 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
28767 int64_t ret_ref = (uintptr_t)ret_copy;
28771 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) {
28772 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
28773 results_constr.datalen = (*env)->GetArrayLength(env, results);
28774 if (results_constr.datalen > 0)
28775 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28777 results_constr.data = NULL;
28778 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
28779 for (size_t w = 0; w < results_constr.datalen; w++) {
28780 int64_t results_conv_22 = results_vals[w];
28781 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
28782 CHECK_ACCESS(results_conv_22_ptr);
28783 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
28784 results_constr.data[w] = results_conv_22_conv;
28786 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
28787 LDKRouteParameters failed_paths_retry_conv;
28788 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
28789 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
28790 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
28791 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
28792 LDKThirtyTwoBytes payment_id_ref;
28793 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
28794 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
28795 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28796 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
28797 int64_t ret_ref = (uintptr_t)ret_copy;
28801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28802 LDKPhantomRouteHints this_obj_conv;
28803 this_obj_conv.inner = (void*)(this_obj & (~1));
28804 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28806 PhantomRouteHints_free(this_obj_conv);
28809 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
28810 LDKPhantomRouteHints this_ptr_conv;
28811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28812 this_ptr_conv.is_owned = false;
28813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28814 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28815 int64_tArray ret_arr = NULL;
28816 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28817 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28818 for (size_t q = 0; q < ret_var.datalen; q++) {
28819 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28820 int64_t ret_conv_16_ref = 0;
28821 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28822 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28823 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28824 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
28825 if (ret_conv_16_var.is_owned) {
28826 ret_conv_16_ref |= 1;
28828 ret_arr_ptr[q] = ret_conv_16_ref;
28830 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28831 FREE(ret_var.data);
28835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
28836 LDKPhantomRouteHints this_ptr_conv;
28837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28838 this_ptr_conv.is_owned = false;
28839 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28840 LDKCVec_ChannelDetailsZ val_constr;
28841 val_constr.datalen = (*env)->GetArrayLength(env, val);
28842 if (val_constr.datalen > 0)
28843 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28845 val_constr.data = NULL;
28846 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
28847 for (size_t q = 0; q < val_constr.datalen; q++) {
28848 int64_t val_conv_16 = val_vals[q];
28849 LDKChannelDetails val_conv_16_conv;
28850 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
28851 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
28852 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28853 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28854 val_constr.data[q] = val_conv_16_conv;
28856 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
28857 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
28861 LDKPhantomRouteHints this_ptr_conv;
28862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28863 this_ptr_conv.is_owned = false;
28864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28865 int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28870 LDKPhantomRouteHints this_ptr_conv;
28871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28872 this_ptr_conv.is_owned = false;
28873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28874 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28878 LDKPhantomRouteHints this_ptr_conv;
28879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28880 this_ptr_conv.is_owned = false;
28881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28882 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28883 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
28887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28888 LDKPhantomRouteHints this_ptr_conv;
28889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28890 this_ptr_conv.is_owned = false;
28891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28892 LDKPublicKey val_ref;
28893 CHECK((*env)->GetArrayLength(env, val) == 33);
28894 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28895 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t phantom_scid_arg, int8_tArray real_node_pubkey_arg) {
28899 LDKCVec_ChannelDetailsZ channels_arg_constr;
28900 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
28901 if (channels_arg_constr.datalen > 0)
28902 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28904 channels_arg_constr.data = NULL;
28905 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
28906 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28907 int64_t channels_arg_conv_16 = channels_arg_vals[q];
28908 LDKChannelDetails channels_arg_conv_16_conv;
28909 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
28910 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
28911 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28912 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28913 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28915 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
28916 LDKPublicKey real_node_pubkey_arg_ref;
28917 CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
28918 (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
28919 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28920 int64_t ret_ref = 0;
28921 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28922 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28924 ret_ref = (uintptr_t)ret_var.inner;
28925 if (ret_var.is_owned) {
28931 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28932 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28933 int64_t ret_ref = 0;
28934 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28935 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28936 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28937 ret_ref = (uintptr_t)ret_var.inner;
28938 if (ret_var.is_owned) {
28943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28944 LDKPhantomRouteHints arg_conv;
28945 arg_conv.inner = (void*)(arg & (~1));
28946 arg_conv.is_owned = false;
28947 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28948 int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
28952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28953 LDKPhantomRouteHints orig_conv;
28954 orig_conv.inner = (void*)(orig & (~1));
28955 orig_conv.is_owned = false;
28956 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28957 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28958 int64_t ret_ref = 0;
28959 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28960 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28961 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28962 ret_ref = (uintptr_t)ret_var.inner;
28963 if (ret_var.is_owned) {
28969 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) {
28970 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
28971 CHECK_ACCESS(fee_est_ptr);
28972 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28973 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28974 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28975 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28977 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
28978 CHECK_ACCESS(chain_monitor_ptr);
28979 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28980 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28981 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28982 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28984 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
28985 CHECK_ACCESS(tx_broadcaster_ptr);
28986 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28987 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28988 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28989 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28991 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
28992 CHECK_ACCESS(logger_ptr);
28993 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28994 if (logger_conv.free == LDKLogger_JCalls_free) {
28995 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28996 LDKLogger_JCalls_cloned(&logger_conv);
28998 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
28999 CHECK_ACCESS(keys_manager_ptr);
29000 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29001 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29002 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29003 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29005 LDKUserConfig config_conv;
29006 config_conv.inner = (void*)(config & (~1));
29007 config_conv.is_owned = (config & 1) || (config == 0);
29008 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
29009 config_conv = UserConfig_clone(&config_conv);
29010 LDKChainParameters params_conv;
29011 params_conv.inner = (void*)(params & (~1));
29012 params_conv.is_owned = (params & 1) || (params == 0);
29013 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
29014 params_conv = ChainParameters_clone(¶ms_conv);
29015 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
29016 int64_t ret_ref = 0;
29017 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29018 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29020 ret_ref = (uintptr_t)ret_var.inner;
29021 if (ret_var.is_owned) {
29027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
29028 LDKChannelManager this_arg_conv;
29029 this_arg_conv.inner = (void*)(this_arg & (~1));
29030 this_arg_conv.is_owned = false;
29031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29032 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
29033 int64_t ret_ref = 0;
29034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29037 ret_ref = (uintptr_t)ret_var.inner;
29038 if (ret_var.is_owned) {
29044 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) {
29045 LDKChannelManager this_arg_conv;
29046 this_arg_conv.inner = (void*)(this_arg & (~1));
29047 this_arg_conv.is_owned = false;
29048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29049 LDKPublicKey their_network_key_ref;
29050 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
29051 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
29052 LDKUserConfig override_config_conv;
29053 override_config_conv.inner = (void*)(override_config & (~1));
29054 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
29055 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
29056 override_config_conv = UserConfig_clone(&override_config_conv);
29057 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
29058 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
29059 return (int64_t)ret_conv;
29062 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29063 LDKChannelManager this_arg_conv;
29064 this_arg_conv.inner = (void*)(this_arg & (~1));
29065 this_arg_conv.is_owned = false;
29066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29067 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
29068 int64_tArray ret_arr = NULL;
29069 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29070 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29071 for (size_t q = 0; q < ret_var.datalen; q++) {
29072 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29073 int64_t ret_conv_16_ref = 0;
29074 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29075 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29077 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
29078 if (ret_conv_16_var.is_owned) {
29079 ret_conv_16_ref |= 1;
29081 ret_arr_ptr[q] = ret_conv_16_ref;
29083 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29084 FREE(ret_var.data);
29088 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29089 LDKChannelManager this_arg_conv;
29090 this_arg_conv.inner = (void*)(this_arg & (~1));
29091 this_arg_conv.is_owned = false;
29092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29093 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
29094 int64_tArray ret_arr = NULL;
29095 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29096 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29097 for (size_t q = 0; q < ret_var.datalen; q++) {
29098 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
29099 int64_t ret_conv_16_ref = 0;
29100 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29101 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29102 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
29103 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
29104 if (ret_conv_16_var.is_owned) {
29105 ret_conv_16_ref |= 1;
29107 ret_arr_ptr[q] = ret_conv_16_ref;
29109 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29110 FREE(ret_var.data);
29114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
29115 LDKChannelManager this_arg_conv;
29116 this_arg_conv.inner = (void*)(this_arg & (~1));
29117 this_arg_conv.is_owned = false;
29118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29119 unsigned char channel_id_arr[32];
29120 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29121 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29122 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29123 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29124 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
29125 return (int64_t)ret_conv;
29128 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) {
29129 LDKChannelManager this_arg_conv;
29130 this_arg_conv.inner = (void*)(this_arg & (~1));
29131 this_arg_conv.is_owned = false;
29132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29133 unsigned char channel_id_arr[32];
29134 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29135 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29136 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29137 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29138 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
29139 return (int64_t)ret_conv;
29142 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) {
29143 LDKChannelManager this_arg_conv;
29144 this_arg_conv.inner = (void*)(this_arg & (~1));
29145 this_arg_conv.is_owned = false;
29146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29147 unsigned char channel_id_arr[32];
29148 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
29149 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
29150 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
29151 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29152 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
29153 return (int64_t)ret_conv;
29156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
29157 LDKChannelManager this_arg_conv;
29158 this_arg_conv.inner = (void*)(this_arg & (~1));
29159 this_arg_conv.is_owned = false;
29160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29161 ChannelManager_force_close_all_channels(&this_arg_conv);
29164 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) {
29165 LDKChannelManager this_arg_conv;
29166 this_arg_conv.inner = (void*)(this_arg & (~1));
29167 this_arg_conv.is_owned = false;
29168 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29169 LDKRoute route_conv;
29170 route_conv.inner = (void*)(route & (~1));
29171 route_conv.is_owned = false;
29172 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29173 LDKThirtyTwoBytes payment_hash_ref;
29174 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29175 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29176 LDKThirtyTwoBytes payment_secret_ref;
29177 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
29178 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
29179 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
29180 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
29181 return (int64_t)ret_conv;
29184 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) {
29185 LDKChannelManager this_arg_conv;
29186 this_arg_conv.inner = (void*)(this_arg & (~1));
29187 this_arg_conv.is_owned = false;
29188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29189 LDKRoute route_conv;
29190 route_conv.inner = (void*)(route & (~1));
29191 route_conv.is_owned = false;
29192 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29193 LDKThirtyTwoBytes payment_id_ref;
29194 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29195 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29196 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29197 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
29198 return (int64_t)ret_conv;
29201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
29202 LDKChannelManager this_arg_conv;
29203 this_arg_conv.inner = (void*)(this_arg & (~1));
29204 this_arg_conv.is_owned = false;
29205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29206 LDKThirtyTwoBytes payment_id_ref;
29207 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
29208 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
29209 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
29212 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) {
29213 LDKChannelManager this_arg_conv;
29214 this_arg_conv.inner = (void*)(this_arg & (~1));
29215 this_arg_conv.is_owned = false;
29216 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29217 LDKRoute route_conv;
29218 route_conv.inner = (void*)(route & (~1));
29219 route_conv.is_owned = false;
29220 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
29221 LDKThirtyTwoBytes payment_preimage_ref;
29222 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29223 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29224 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
29225 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
29226 return (int64_t)ret_conv;
29229 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) {
29230 LDKChannelManager this_arg_conv;
29231 this_arg_conv.inner = (void*)(this_arg & (~1));
29232 this_arg_conv.is_owned = false;
29233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29234 unsigned char temporary_channel_id_arr[32];
29235 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29236 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29237 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29238 LDKTransaction funding_transaction_ref;
29239 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
29240 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
29241 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
29242 funding_transaction_ref.data_is_owned = true;
29243 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29244 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
29245 return (int64_t)ret_conv;
29248 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) {
29249 LDKChannelManager this_arg_conv;
29250 this_arg_conv.inner = (void*)(this_arg & (~1));
29251 this_arg_conv.is_owned = false;
29252 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29253 LDKThreeBytes rgb_ref;
29254 CHECK((*env)->GetArrayLength(env, rgb) == 3);
29255 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
29256 LDKThirtyTwoBytes alias_ref;
29257 CHECK((*env)->GetArrayLength(env, alias) == 32);
29258 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
29259 LDKCVec_NetAddressZ addresses_constr;
29260 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
29261 if (addresses_constr.datalen > 0)
29262 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
29264 addresses_constr.data = NULL;
29265 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
29266 for (size_t m = 0; m < addresses_constr.datalen; m++) {
29267 int64_t addresses_conv_12 = addresses_vals[m];
29268 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
29269 CHECK_ACCESS(addresses_conv_12_ptr);
29270 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
29271 addresses_constr.data[m] = addresses_conv_12_conv;
29273 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
29274 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
29277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
29278 LDKChannelManager this_arg_conv;
29279 this_arg_conv.inner = (void*)(this_arg & (~1));
29280 this_arg_conv.is_owned = false;
29281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29282 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
29285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
29286 LDKChannelManager this_arg_conv;
29287 this_arg_conv.inner = (void*)(this_arg & (~1));
29288 this_arg_conv.is_owned = false;
29289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29290 ChannelManager_timer_tick_occurred(&this_arg_conv);
29293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
29294 LDKChannelManager this_arg_conv;
29295 this_arg_conv.inner = (void*)(this_arg & (~1));
29296 this_arg_conv.is_owned = false;
29297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29298 unsigned char payment_hash_arr[32];
29299 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29300 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
29301 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
29302 jboolean ret_conv = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
29306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
29307 LDKChannelManager this_arg_conv;
29308 this_arg_conv.inner = (void*)(this_arg & (~1));
29309 this_arg_conv.is_owned = false;
29310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29311 LDKThirtyTwoBytes payment_preimage_ref;
29312 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
29313 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
29314 jboolean ret_conv = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
29318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
29319 LDKChannelManager this_arg_conv;
29320 this_arg_conv.inner = (void*)(this_arg & (~1));
29321 this_arg_conv.is_owned = false;
29322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29323 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29324 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
29328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int64_t user_channel_id) {
29329 LDKChannelManager this_arg_conv;
29330 this_arg_conv.inner = (void*)(this_arg & (~1));
29331 this_arg_conv.is_owned = false;
29332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29333 unsigned char temporary_channel_id_arr[32];
29334 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
29335 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
29336 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
29337 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
29338 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, user_channel_id);
29339 return (int64_t)ret_conv;
29342 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) {
29343 LDKChannelManager this_arg_conv;
29344 this_arg_conv.inner = (void*)(this_arg & (~1));
29345 this_arg_conv.is_owned = false;
29346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29347 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
29348 CHECK_ACCESS(min_value_msat_ptr);
29349 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29350 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
29351 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29352 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29353 return (int64_t)ret_conv;
29356 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) {
29357 LDKChannelManager this_arg_conv;
29358 this_arg_conv.inner = (void*)(this_arg & (~1));
29359 this_arg_conv.is_owned = false;
29360 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29361 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
29362 CHECK_ACCESS(min_value_msat_ptr);
29363 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29364 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
29365 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
29366 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
29367 return (int64_t)ret_conv;
29370 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) {
29371 LDKChannelManager this_arg_conv;
29372 this_arg_conv.inner = (void*)(this_arg & (~1));
29373 this_arg_conv.is_owned = false;
29374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29375 LDKThirtyTwoBytes payment_hash_ref;
29376 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29377 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29378 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
29379 CHECK_ACCESS(min_value_msat_ptr);
29380 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29381 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
29382 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29383 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29384 return (int64_t)ret_conv;
29387 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) {
29388 LDKChannelManager this_arg_conv;
29389 this_arg_conv.inner = (void*)(this_arg & (~1));
29390 this_arg_conv.is_owned = false;
29391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29392 LDKThirtyTwoBytes payment_hash_ref;
29393 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29394 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29395 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
29396 CHECK_ACCESS(min_value_msat_ptr);
29397 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29398 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
29399 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
29400 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
29401 return (int64_t)ret_conv;
29404 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) {
29405 LDKChannelManager this_arg_conv;
29406 this_arg_conv.inner = (void*)(this_arg & (~1));
29407 this_arg_conv.is_owned = false;
29408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29409 LDKThirtyTwoBytes payment_hash_ref;
29410 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
29411 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
29412 LDKThirtyTwoBytes payment_secret_ref;
29413 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
29414 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
29415 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
29416 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
29417 return (int64_t)ret_conv;
29420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
29421 LDKChannelManager this_arg_conv;
29422 this_arg_conv.inner = (void*)(this_arg & (~1));
29423 this_arg_conv.is_owned = false;
29424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29425 int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
29429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
29430 LDKChannelManager this_arg_conv;
29431 this_arg_conv.inner = (void*)(this_arg & (~1));
29432 this_arg_conv.is_owned = false;
29433 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29434 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
29435 int64_t ret_ref = 0;
29436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29439 ret_ref = (uintptr_t)ret_var.inner;
29440 if (ret_var.is_owned) {
29446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
29447 LDKChannelManager this_arg_conv;
29448 this_arg_conv.inner = (void*)(this_arg & (~1));
29449 this_arg_conv.is_owned = false;
29450 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29451 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
29452 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
29453 return (int64_t)ret_ret;
29456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
29457 LDKChannelManager this_arg_conv;
29458 this_arg_conv.inner = (void*)(this_arg & (~1));
29459 this_arg_conv.is_owned = false;
29460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29461 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
29462 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
29463 return (int64_t)ret_ret;
29466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
29467 LDKChannelManager this_arg_conv;
29468 this_arg_conv.inner = (void*)(this_arg & (~1));
29469 this_arg_conv.is_owned = false;
29470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29471 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29472 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29473 return (int64_t)ret_ret;
29476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
29477 LDKChannelManager this_arg_conv;
29478 this_arg_conv.inner = (void*)(this_arg & (~1));
29479 this_arg_conv.is_owned = false;
29480 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29481 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29482 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29483 return (int64_t)ret_ret;
29486 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) {
29487 LDKChannelManager this_arg_conv;
29488 this_arg_conv.inner = (void*)(this_arg & (~1));
29489 this_arg_conv.is_owned = false;
29490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29491 jboolean ret_conv = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
29495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
29496 LDKChannelManager this_arg_conv;
29497 this_arg_conv.inner = (void*)(this_arg & (~1));
29498 this_arg_conv.is_owned = false;
29499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29500 ChannelManager_await_persistable_update(&this_arg_conv);
29503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
29504 LDKChannelManager this_arg_conv;
29505 this_arg_conv.inner = (void*)(this_arg & (~1));
29506 this_arg_conv.is_owned = false;
29507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29508 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29509 int64_t ret_ref = 0;
29510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29513 ret_ref = (uintptr_t)ret_var.inner;
29514 if (ret_var.is_owned) {
29520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
29521 LDKChannelManager this_arg_conv;
29522 this_arg_conv.inner = (void*)(this_arg & (~1));
29523 this_arg_conv.is_owned = false;
29524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29525 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29526 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29527 return (int64_t)ret_ret;
29530 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
29531 LDKCounterpartyForwardingInfo obj_conv;
29532 obj_conv.inner = (void*)(obj & (~1));
29533 obj_conv.is_owned = false;
29534 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29535 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29536 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29537 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29538 CVec_u8Z_free(ret_var);
29542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29543 LDKu8slice ser_ref;
29544 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29545 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29546 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29547 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29548 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29549 return (int64_t)ret_conv;
29552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
29553 LDKChannelCounterparty obj_conv;
29554 obj_conv.inner = (void*)(obj & (~1));
29555 obj_conv.is_owned = false;
29556 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29557 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29558 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29559 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29560 CVec_u8Z_free(ret_var);
29564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29565 LDKu8slice ser_ref;
29566 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29567 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29568 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29569 *ret_conv = ChannelCounterparty_read(ser_ref);
29570 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29571 return (int64_t)ret_conv;
29574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
29575 LDKChannelDetails obj_conv;
29576 obj_conv.inner = (void*)(obj & (~1));
29577 obj_conv.is_owned = false;
29578 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29579 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29580 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29581 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29582 CVec_u8Z_free(ret_var);
29586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29587 LDKu8slice ser_ref;
29588 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29589 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29590 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29591 *ret_conv = ChannelDetails_read(ser_ref);
29592 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29593 return (int64_t)ret_conv;
29596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
29597 LDKPhantomRouteHints obj_conv;
29598 obj_conv.inner = (void*)(obj & (~1));
29599 obj_conv.is_owned = false;
29600 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29601 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29602 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29603 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29604 CVec_u8Z_free(ret_var);
29608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29609 LDKu8slice ser_ref;
29610 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29611 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29612 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29613 *ret_conv = PhantomRouteHints_read(ser_ref);
29614 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29615 return (int64_t)ret_conv;
29618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
29619 LDKChannelManager obj_conv;
29620 obj_conv.inner = (void*)(obj & (~1));
29621 obj_conv.is_owned = false;
29622 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29623 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29624 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29625 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29626 CVec_u8Z_free(ret_var);
29630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29631 LDKChannelManagerReadArgs this_obj_conv;
29632 this_obj_conv.inner = (void*)(this_obj & (~1));
29633 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29635 ChannelManagerReadArgs_free(this_obj_conv);
29638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
29639 LDKChannelManagerReadArgs this_ptr_conv;
29640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29641 this_ptr_conv.is_owned = false;
29642 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29643 // WARNING: This object doesn't live past this scope, needs clone!
29644 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
29648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29649 LDKChannelManagerReadArgs this_ptr_conv;
29650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29651 this_ptr_conv.is_owned = false;
29652 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29653 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29654 CHECK_ACCESS(val_ptr);
29655 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
29656 if (val_conv.free == LDKKeysInterface_JCalls_free) {
29657 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29658 LDKKeysInterface_JCalls_cloned(&val_conv);
29660 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
29663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
29664 LDKChannelManagerReadArgs this_ptr_conv;
29665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29666 this_ptr_conv.is_owned = false;
29667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29668 // WARNING: This object doesn't live past this scope, needs clone!
29669 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
29673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29674 LDKChannelManagerReadArgs this_ptr_conv;
29675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29676 this_ptr_conv.is_owned = false;
29677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29678 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29679 CHECK_ACCESS(val_ptr);
29680 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29681 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29682 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29683 LDKFeeEstimator_JCalls_cloned(&val_conv);
29685 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
29689 LDKChannelManagerReadArgs this_ptr_conv;
29690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29691 this_ptr_conv.is_owned = false;
29692 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29693 // WARNING: This object doesn't live past this scope, needs clone!
29694 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
29698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29699 LDKChannelManagerReadArgs this_ptr_conv;
29700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29701 this_ptr_conv.is_owned = false;
29702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29703 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29704 CHECK_ACCESS(val_ptr);
29705 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29706 if (val_conv.free == LDKWatch_JCalls_free) {
29707 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29708 LDKWatch_JCalls_cloned(&val_conv);
29710 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
29714 LDKChannelManagerReadArgs 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 // WARNING: This object doesn't live past this scope, needs clone!
29719 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
29723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29724 LDKChannelManagerReadArgs 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 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29729 CHECK_ACCESS(val_ptr);
29730 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29731 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29732 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29733 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29735 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
29739 LDKChannelManagerReadArgs this_ptr_conv;
29740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29741 this_ptr_conv.is_owned = false;
29742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29743 // WARNING: This object doesn't live past this scope, needs clone!
29744 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
29748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29749 LDKChannelManagerReadArgs this_ptr_conv;
29750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29751 this_ptr_conv.is_owned = false;
29752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29753 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29754 CHECK_ACCESS(val_ptr);
29755 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
29756 if (val_conv.free == LDKLogger_JCalls_free) {
29757 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29758 LDKLogger_JCalls_cloned(&val_conv);
29760 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
29763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
29764 LDKChannelManagerReadArgs this_ptr_conv;
29765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29766 this_ptr_conv.is_owned = false;
29767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29768 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
29769 int64_t ret_ref = 0;
29770 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29771 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29772 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29773 ret_ref = (uintptr_t)ret_var.inner;
29774 if (ret_var.is_owned) {
29780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29781 LDKChannelManagerReadArgs this_ptr_conv;
29782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29783 this_ptr_conv.is_owned = false;
29784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29785 LDKUserConfig val_conv;
29786 val_conv.inner = (void*)(val & (~1));
29787 val_conv.is_owned = (val & 1) || (val == 0);
29788 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29789 val_conv = UserConfig_clone(&val_conv);
29790 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
29793 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) {
29794 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
29795 CHECK_ACCESS(keys_manager_ptr);
29796 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29797 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29798 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29799 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29801 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
29802 CHECK_ACCESS(fee_estimator_ptr);
29803 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29804 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29805 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29806 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29808 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
29809 CHECK_ACCESS(chain_monitor_ptr);
29810 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29811 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29812 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29813 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29815 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
29816 CHECK_ACCESS(tx_broadcaster_ptr);
29817 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29818 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29819 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29820 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29822 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
29823 CHECK_ACCESS(logger_ptr);
29824 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29825 if (logger_conv.free == LDKLogger_JCalls_free) {
29826 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29827 LDKLogger_JCalls_cloned(&logger_conv);
29829 LDKUserConfig default_config_conv;
29830 default_config_conv.inner = (void*)(default_config & (~1));
29831 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
29832 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
29833 default_config_conv = UserConfig_clone(&default_config_conv);
29834 LDKCVec_ChannelMonitorZ channel_monitors_constr;
29835 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
29836 if (channel_monitors_constr.datalen > 0)
29837 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
29839 channel_monitors_constr.data = NULL;
29840 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
29841 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
29842 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
29843 LDKChannelMonitor channel_monitors_conv_16_conv;
29844 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
29845 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
29846 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
29847 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
29849 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
29850 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);
29851 int64_t ret_ref = 0;
29852 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29853 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29855 ret_ref = (uintptr_t)ret_var.inner;
29856 if (ret_var.is_owned) {
29862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
29863 LDKu8slice ser_ref;
29864 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29865 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29866 LDKChannelManagerReadArgs arg_conv;
29867 arg_conv.inner = (void*)(arg & (~1));
29868 arg_conv.is_owned = (arg & 1) || (arg == 0);
29869 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29870 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
29871 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
29872 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
29873 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29874 return (int64_t)ret_conv;
29877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29878 LDKDecodeError this_obj_conv;
29879 this_obj_conv.inner = (void*)(this_obj & (~1));
29880 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29882 DecodeError_free(this_obj_conv);
29885 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
29886 LDKDecodeError ret_var = DecodeError_clone(arg);
29887 int64_t ret_ref = 0;
29888 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29889 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29890 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29891 ret_ref = (uintptr_t)ret_var.inner;
29892 if (ret_var.is_owned) {
29897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29898 LDKDecodeError arg_conv;
29899 arg_conv.inner = (void*)(arg & (~1));
29900 arg_conv.is_owned = false;
29901 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29902 int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
29906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29907 LDKDecodeError orig_conv;
29908 orig_conv.inner = (void*)(orig & (~1));
29909 orig_conv.is_owned = false;
29910 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29911 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
29912 int64_t ret_ref = 0;
29913 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29914 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29915 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29916 ret_ref = (uintptr_t)ret_var.inner;
29917 if (ret_var.is_owned) {
29923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29924 LDKInit this_obj_conv;
29925 this_obj_conv.inner = (void*)(this_obj & (~1));
29926 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29928 Init_free(this_obj_conv);
29931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29932 LDKInit this_ptr_conv;
29933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29934 this_ptr_conv.is_owned = false;
29935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29936 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
29937 int64_t ret_ref = 0;
29938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29941 ret_ref = (uintptr_t)ret_var.inner;
29942 if (ret_var.is_owned) {
29948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29949 LDKInit this_ptr_conv;
29950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29951 this_ptr_conv.is_owned = false;
29952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29953 LDKInitFeatures val_conv;
29954 val_conv.inner = (void*)(val & (~1));
29955 val_conv.is_owned = (val & 1) || (val == 0);
29956 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29957 val_conv = InitFeatures_clone(&val_conv);
29958 Init_set_features(&this_ptr_conv, val_conv);
29961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
29962 LDKInit this_ptr_conv;
29963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29964 this_ptr_conv.is_owned = false;
29965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29966 LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
29967 *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
29968 int64_t ret_ref = (uintptr_t)ret_copy;
29972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29973 LDKInit this_ptr_conv;
29974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29975 this_ptr_conv.is_owned = false;
29976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29977 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29978 CHECK_ACCESS(val_ptr);
29979 LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
29980 val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1));
29981 Init_set_remote_network_address(&this_ptr_conv, val_conv);
29984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t remote_network_address_arg) {
29985 LDKInitFeatures features_arg_conv;
29986 features_arg_conv.inner = (void*)(features_arg & (~1));
29987 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
29988 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
29989 features_arg_conv = InitFeatures_clone(&features_arg_conv);
29990 void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1);
29991 CHECK_ACCESS(remote_network_address_arg_ptr);
29992 LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
29993 LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
29994 int64_t ret_ref = 0;
29995 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29996 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29998 ret_ref = (uintptr_t)ret_var.inner;
29999 if (ret_var.is_owned) {
30005 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
30006 LDKInit ret_var = Init_clone(arg);
30007 int64_t ret_ref = 0;
30008 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30009 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30010 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30011 ret_ref = (uintptr_t)ret_var.inner;
30012 if (ret_var.is_owned) {
30017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30019 arg_conv.inner = (void*)(arg & (~1));
30020 arg_conv.is_owned = false;
30021 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30022 int64_t ret_conv = Init_clone_ptr(&arg_conv);
30026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30028 orig_conv.inner = (void*)(orig & (~1));
30029 orig_conv.is_owned = false;
30030 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30031 LDKInit ret_var = Init_clone(&orig_conv);
30032 int64_t ret_ref = 0;
30033 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30034 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30035 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30036 ret_ref = (uintptr_t)ret_var.inner;
30037 if (ret_var.is_owned) {
30043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30044 LDKErrorMessage this_obj_conv;
30045 this_obj_conv.inner = (void*)(this_obj & (~1));
30046 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30047 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30048 ErrorMessage_free(this_obj_conv);
30051 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30052 LDKErrorMessage this_ptr_conv;
30053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30054 this_ptr_conv.is_owned = false;
30055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30056 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30057 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
30061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30062 LDKErrorMessage this_ptr_conv;
30063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30064 this_ptr_conv.is_owned = false;
30065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30066 LDKThirtyTwoBytes val_ref;
30067 CHECK((*env)->GetArrayLength(env, val) == 32);
30068 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30069 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
30072 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30073 LDKErrorMessage this_ptr_conv;
30074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30075 this_ptr_conv.is_owned = false;
30076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30077 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
30078 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30084 LDKErrorMessage this_ptr_conv;
30085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30086 this_ptr_conv.is_owned = false;
30087 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30088 LDKStr val_conv = java_to_owned_str(env, val);
30089 ErrorMessage_set_data(&this_ptr_conv, val_conv);
30092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30093 LDKThirtyTwoBytes channel_id_arg_ref;
30094 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30095 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30096 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30097 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
30098 int64_t ret_ref = 0;
30099 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30100 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30102 ret_ref = (uintptr_t)ret_var.inner;
30103 if (ret_var.is_owned) {
30109 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
30110 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
30111 int64_t ret_ref = 0;
30112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30115 ret_ref = (uintptr_t)ret_var.inner;
30116 if (ret_var.is_owned) {
30121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30122 LDKErrorMessage arg_conv;
30123 arg_conv.inner = (void*)(arg & (~1));
30124 arg_conv.is_owned = false;
30125 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30126 int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
30130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30131 LDKErrorMessage orig_conv;
30132 orig_conv.inner = (void*)(orig & (~1));
30133 orig_conv.is_owned = false;
30134 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30135 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
30136 int64_t ret_ref = 0;
30137 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30138 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30139 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30140 ret_ref = (uintptr_t)ret_var.inner;
30141 if (ret_var.is_owned) {
30147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30148 LDKWarningMessage this_obj_conv;
30149 this_obj_conv.inner = (void*)(this_obj & (~1));
30150 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30152 WarningMessage_free(this_obj_conv);
30155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30156 LDKWarningMessage this_ptr_conv;
30157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30158 this_ptr_conv.is_owned = false;
30159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30160 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30161 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
30165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30166 LDKWarningMessage this_ptr_conv;
30167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30168 this_ptr_conv.is_owned = false;
30169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30170 LDKThirtyTwoBytes val_ref;
30171 CHECK((*env)->GetArrayLength(env, val) == 32);
30172 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30173 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
30176 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
30177 LDKWarningMessage this_ptr_conv;
30178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30179 this_ptr_conv.is_owned = false;
30180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30181 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
30182 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
30187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
30188 LDKWarningMessage this_ptr_conv;
30189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30190 this_ptr_conv.is_owned = false;
30191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30192 LDKStr val_conv = java_to_owned_str(env, val);
30193 WarningMessage_set_data(&this_ptr_conv, val_conv);
30196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
30197 LDKThirtyTwoBytes channel_id_arg_ref;
30198 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30199 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30200 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
30201 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
30202 int64_t ret_ref = 0;
30203 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30204 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30206 ret_ref = (uintptr_t)ret_var.inner;
30207 if (ret_var.is_owned) {
30213 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
30214 LDKWarningMessage ret_var = WarningMessage_clone(arg);
30215 int64_t ret_ref = 0;
30216 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30217 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30219 ret_ref = (uintptr_t)ret_var.inner;
30220 if (ret_var.is_owned) {
30225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30226 LDKWarningMessage arg_conv;
30227 arg_conv.inner = (void*)(arg & (~1));
30228 arg_conv.is_owned = false;
30229 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30230 int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
30234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30235 LDKWarningMessage orig_conv;
30236 orig_conv.inner = (void*)(orig & (~1));
30237 orig_conv.is_owned = false;
30238 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30239 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
30240 int64_t ret_ref = 0;
30241 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30242 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30243 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30244 ret_ref = (uintptr_t)ret_var.inner;
30245 if (ret_var.is_owned) {
30251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30252 LDKPing this_obj_conv;
30253 this_obj_conv.inner = (void*)(this_obj & (~1));
30254 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30256 Ping_free(this_obj_conv);
30259 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30260 LDKPing this_ptr_conv;
30261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30262 this_ptr_conv.is_owned = false;
30263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30264 int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
30268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30269 LDKPing this_ptr_conv;
30270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30271 this_ptr_conv.is_owned = false;
30272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30273 Ping_set_ponglen(&this_ptr_conv, val);
30276 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30277 LDKPing this_ptr_conv;
30278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30279 this_ptr_conv.is_owned = false;
30280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30281 int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
30285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30286 LDKPing this_ptr_conv;
30287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30288 this_ptr_conv.is_owned = false;
30289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30290 Ping_set_byteslen(&this_ptr_conv, val);
30293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
30294 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
30295 int64_t ret_ref = 0;
30296 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30297 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30298 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30299 ret_ref = (uintptr_t)ret_var.inner;
30300 if (ret_var.is_owned) {
30306 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
30307 LDKPing ret_var = Ping_clone(arg);
30308 int64_t ret_ref = 0;
30309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30312 ret_ref = (uintptr_t)ret_var.inner;
30313 if (ret_var.is_owned) {
30318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30320 arg_conv.inner = (void*)(arg & (~1));
30321 arg_conv.is_owned = false;
30322 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30323 int64_t ret_conv = Ping_clone_ptr(&arg_conv);
30327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30329 orig_conv.inner = (void*)(orig & (~1));
30330 orig_conv.is_owned = false;
30331 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30332 LDKPing ret_var = Ping_clone(&orig_conv);
30333 int64_t ret_ref = 0;
30334 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30335 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30336 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30337 ret_ref = (uintptr_t)ret_var.inner;
30338 if (ret_var.is_owned) {
30344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30345 LDKPong this_obj_conv;
30346 this_obj_conv.inner = (void*)(this_obj & (~1));
30347 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30349 Pong_free(this_obj_conv);
30352 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
30353 LDKPong this_ptr_conv;
30354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30355 this_ptr_conv.is_owned = false;
30356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30357 int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
30361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30362 LDKPong this_ptr_conv;
30363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30364 this_ptr_conv.is_owned = false;
30365 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30366 Pong_set_byteslen(&this_ptr_conv, val);
30369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
30370 LDKPong ret_var = Pong_new(byteslen_arg);
30371 int64_t ret_ref = 0;
30372 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30373 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30375 ret_ref = (uintptr_t)ret_var.inner;
30376 if (ret_var.is_owned) {
30382 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30383 LDKPong ret_var = Pong_clone(arg);
30384 int64_t ret_ref = 0;
30385 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30386 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30387 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30388 ret_ref = (uintptr_t)ret_var.inner;
30389 if (ret_var.is_owned) {
30394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30396 arg_conv.inner = (void*)(arg & (~1));
30397 arg_conv.is_owned = false;
30398 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30399 int64_t ret_conv = Pong_clone_ptr(&arg_conv);
30403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30405 orig_conv.inner = (void*)(orig & (~1));
30406 orig_conv.is_owned = false;
30407 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30408 LDKPong ret_var = Pong_clone(&orig_conv);
30409 int64_t ret_ref = 0;
30410 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30411 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30412 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30413 ret_ref = (uintptr_t)ret_var.inner;
30414 if (ret_var.is_owned) {
30420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30421 LDKOpenChannel this_obj_conv;
30422 this_obj_conv.inner = (void*)(this_obj & (~1));
30423 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30425 OpenChannel_free(this_obj_conv);
30428 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
30429 LDKOpenChannel this_ptr_conv;
30430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30431 this_ptr_conv.is_owned = false;
30432 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30433 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30434 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
30438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30439 LDKOpenChannel this_ptr_conv;
30440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30441 this_ptr_conv.is_owned = false;
30442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30443 LDKThirtyTwoBytes val_ref;
30444 CHECK((*env)->GetArrayLength(env, val) == 32);
30445 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30446 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30450 LDKOpenChannel this_ptr_conv;
30451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30452 this_ptr_conv.is_owned = false;
30453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30454 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30455 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
30459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30460 LDKOpenChannel this_ptr_conv;
30461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30462 this_ptr_conv.is_owned = false;
30463 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30464 LDKThirtyTwoBytes val_ref;
30465 CHECK((*env)->GetArrayLength(env, val) == 32);
30466 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30467 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30471 LDKOpenChannel this_ptr_conv;
30472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30473 this_ptr_conv.is_owned = false;
30474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30475 int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30480 LDKOpenChannel this_ptr_conv;
30481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30482 this_ptr_conv.is_owned = false;
30483 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30484 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30488 LDKOpenChannel this_ptr_conv;
30489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30490 this_ptr_conv.is_owned = false;
30491 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30492 int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
30496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30497 LDKOpenChannel this_ptr_conv;
30498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30499 this_ptr_conv.is_owned = false;
30500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30501 OpenChannel_set_push_msat(&this_ptr_conv, val);
30504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30505 LDKOpenChannel this_ptr_conv;
30506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30507 this_ptr_conv.is_owned = false;
30508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30509 int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30514 LDKOpenChannel this_ptr_conv;
30515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30516 this_ptr_conv.is_owned = false;
30517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30518 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30521 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) {
30522 LDKOpenChannel this_ptr_conv;
30523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30524 this_ptr_conv.is_owned = false;
30525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30526 int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30530 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) {
30531 LDKOpenChannel this_ptr_conv;
30532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30533 this_ptr_conv.is_owned = false;
30534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30535 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30539 LDKOpenChannel this_ptr_conv;
30540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30541 this_ptr_conv.is_owned = false;
30542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30543 int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30548 LDKOpenChannel this_ptr_conv;
30549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30550 this_ptr_conv.is_owned = false;
30551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30552 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30556 LDKOpenChannel this_ptr_conv;
30557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30558 this_ptr_conv.is_owned = false;
30559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30560 int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30565 LDKOpenChannel this_ptr_conv;
30566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30567 this_ptr_conv.is_owned = false;
30568 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30569 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30572 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
30573 LDKOpenChannel this_ptr_conv;
30574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30575 this_ptr_conv.is_owned = false;
30576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30577 int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
30581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30582 LDKOpenChannel this_ptr_conv;
30583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30584 this_ptr_conv.is_owned = false;
30585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30586 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
30589 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30590 LDKOpenChannel this_ptr_conv;
30591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30592 this_ptr_conv.is_owned = false;
30593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30594 int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
30598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30599 LDKOpenChannel this_ptr_conv;
30600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30601 this_ptr_conv.is_owned = false;
30602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30603 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
30606 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
30607 LDKOpenChannel this_ptr_conv;
30608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30609 this_ptr_conv.is_owned = false;
30610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30611 int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
30615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30616 LDKOpenChannel 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 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30624 LDKOpenChannel this_ptr_conv;
30625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30626 this_ptr_conv.is_owned = false;
30627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30628 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30629 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
30633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30634 LDKOpenChannel this_ptr_conv;
30635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30636 this_ptr_conv.is_owned = false;
30637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30638 LDKPublicKey val_ref;
30639 CHECK((*env)->GetArrayLength(env, val) == 33);
30640 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30641 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30644 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30645 LDKOpenChannel this_ptr_conv;
30646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30647 this_ptr_conv.is_owned = false;
30648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30649 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30650 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
30654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30655 LDKOpenChannel this_ptr_conv;
30656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30657 this_ptr_conv.is_owned = false;
30658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30659 LDKPublicKey val_ref;
30660 CHECK((*env)->GetArrayLength(env, val) == 33);
30661 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30662 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30666 LDKOpenChannel this_ptr_conv;
30667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30668 this_ptr_conv.is_owned = false;
30669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30670 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30671 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
30675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30676 LDKOpenChannel this_ptr_conv;
30677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30678 this_ptr_conv.is_owned = false;
30679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30680 LDKPublicKey val_ref;
30681 CHECK((*env)->GetArrayLength(env, val) == 33);
30682 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30683 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
30686 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30687 LDKOpenChannel this_ptr_conv;
30688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30689 this_ptr_conv.is_owned = false;
30690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30691 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30692 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
30696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30697 LDKOpenChannel this_ptr_conv;
30698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30699 this_ptr_conv.is_owned = false;
30700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30701 LDKPublicKey val_ref;
30702 CHECK((*env)->GetArrayLength(env, val) == 33);
30703 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30704 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
30707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30708 LDKOpenChannel this_ptr_conv;
30709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30710 this_ptr_conv.is_owned = false;
30711 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30712 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30713 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
30717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30718 LDKOpenChannel this_ptr_conv;
30719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30720 this_ptr_conv.is_owned = false;
30721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30722 LDKPublicKey val_ref;
30723 CHECK((*env)->GetArrayLength(env, val) == 33);
30724 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30725 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
30728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30729 LDKOpenChannel this_ptr_conv;
30730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30731 this_ptr_conv.is_owned = false;
30732 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30733 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30734 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
30738 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) {
30739 LDKOpenChannel this_ptr_conv;
30740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30741 this_ptr_conv.is_owned = false;
30742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30743 LDKPublicKey val_ref;
30744 CHECK((*env)->GetArrayLength(env, val) == 33);
30745 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30746 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
30749 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
30750 LDKOpenChannel this_ptr_conv;
30751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30752 this_ptr_conv.is_owned = false;
30753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30754 int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
30758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
30759 LDKOpenChannel this_ptr_conv;
30760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30761 this_ptr_conv.is_owned = false;
30762 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30763 OpenChannel_set_channel_flags(&this_ptr_conv, val);
30766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
30767 LDKOpenChannel this_ptr_conv;
30768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30769 this_ptr_conv.is_owned = false;
30770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30771 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
30772 int64_t ret_ref = 0;
30773 if ((uintptr_t)ret_var.inner > 4096) {
30774 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30775 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30776 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30777 ret_ref = (uintptr_t)ret_var.inner;
30778 if (ret_var.is_owned) {
30785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30786 LDKOpenChannel this_ptr_conv;
30787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30788 this_ptr_conv.is_owned = false;
30789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30790 LDKChannelTypeFeatures val_conv;
30791 val_conv.inner = (void*)(val & (~1));
30792 val_conv.is_owned = (val & 1) || (val == 0);
30793 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30794 val_conv = ChannelTypeFeatures_clone(&val_conv);
30795 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
30798 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
30799 LDKOpenChannel ret_var = OpenChannel_clone(arg);
30800 int64_t ret_ref = 0;
30801 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30802 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30803 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30804 ret_ref = (uintptr_t)ret_var.inner;
30805 if (ret_var.is_owned) {
30810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30811 LDKOpenChannel arg_conv;
30812 arg_conv.inner = (void*)(arg & (~1));
30813 arg_conv.is_owned = false;
30814 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30815 int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
30819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30820 LDKOpenChannel orig_conv;
30821 orig_conv.inner = (void*)(orig & (~1));
30822 orig_conv.is_owned = false;
30823 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30824 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
30825 int64_t ret_ref = 0;
30826 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30827 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30828 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30829 ret_ref = (uintptr_t)ret_var.inner;
30830 if (ret_var.is_owned) {
30836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30837 LDKAcceptChannel this_obj_conv;
30838 this_obj_conv.inner = (void*)(this_obj & (~1));
30839 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30841 AcceptChannel_free(this_obj_conv);
30844 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30845 LDKAcceptChannel this_ptr_conv;
30846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30847 this_ptr_conv.is_owned = false;
30848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30849 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30850 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
30854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30855 LDKAcceptChannel this_ptr_conv;
30856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30857 this_ptr_conv.is_owned = false;
30858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30859 LDKThirtyTwoBytes val_ref;
30860 CHECK((*env)->GetArrayLength(env, val) == 32);
30861 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30862 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30866 LDKAcceptChannel this_ptr_conv;
30867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30868 this_ptr_conv.is_owned = false;
30869 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30870 int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
30874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30875 LDKAcceptChannel this_ptr_conv;
30876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30877 this_ptr_conv.is_owned = false;
30878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30879 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30882 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) {
30883 LDKAcceptChannel this_ptr_conv;
30884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30885 this_ptr_conv.is_owned = false;
30886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30887 int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30891 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) {
30892 LDKAcceptChannel this_ptr_conv;
30893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30894 this_ptr_conv.is_owned = false;
30895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30896 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30900 LDKAcceptChannel this_ptr_conv;
30901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30902 this_ptr_conv.is_owned = false;
30903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30904 int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30909 LDKAcceptChannel 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 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30917 LDKAcceptChannel this_ptr_conv;
30918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30919 this_ptr_conv.is_owned = false;
30920 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30921 int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
30925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30926 LDKAcceptChannel this_ptr_conv;
30927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30928 this_ptr_conv.is_owned = false;
30929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30930 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30933 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
30934 LDKAcceptChannel this_ptr_conv;
30935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30936 this_ptr_conv.is_owned = false;
30937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30938 int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
30942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30943 LDKAcceptChannel this_ptr_conv;
30944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30945 this_ptr_conv.is_owned = false;
30946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30947 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
30950 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30951 LDKAcceptChannel this_ptr_conv;
30952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30953 this_ptr_conv.is_owned = false;
30954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30955 int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
30959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30960 LDKAcceptChannel this_ptr_conv;
30961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30962 this_ptr_conv.is_owned = false;
30963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30964 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
30967 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
30968 LDKAcceptChannel this_ptr_conv;
30969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30970 this_ptr_conv.is_owned = false;
30971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30972 int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
30976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30977 LDKAcceptChannel this_ptr_conv;
30978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30979 this_ptr_conv.is_owned = false;
30980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30981 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30984 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30985 LDKAcceptChannel this_ptr_conv;
30986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30987 this_ptr_conv.is_owned = false;
30988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30989 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30990 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
30994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30995 LDKAcceptChannel this_ptr_conv;
30996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30997 this_ptr_conv.is_owned = false;
30998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30999 LDKPublicKey val_ref;
31000 CHECK((*env)->GetArrayLength(env, val) == 33);
31001 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31002 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
31005 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31006 LDKAcceptChannel this_ptr_conv;
31007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31008 this_ptr_conv.is_owned = false;
31009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31010 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31011 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
31015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31016 LDKAcceptChannel this_ptr_conv;
31017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31018 this_ptr_conv.is_owned = false;
31019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31020 LDKPublicKey val_ref;
31021 CHECK((*env)->GetArrayLength(env, val) == 33);
31022 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31023 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
31026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31027 LDKAcceptChannel this_ptr_conv;
31028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31029 this_ptr_conv.is_owned = false;
31030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31031 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31032 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
31036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31037 LDKAcceptChannel this_ptr_conv;
31038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31039 this_ptr_conv.is_owned = false;
31040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31041 LDKPublicKey val_ref;
31042 CHECK((*env)->GetArrayLength(env, val) == 33);
31043 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31044 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
31047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31048 LDKAcceptChannel this_ptr_conv;
31049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31050 this_ptr_conv.is_owned = false;
31051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31052 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31053 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
31057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31058 LDKAcceptChannel this_ptr_conv;
31059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31060 this_ptr_conv.is_owned = false;
31061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31062 LDKPublicKey val_ref;
31063 CHECK((*env)->GetArrayLength(env, val) == 33);
31064 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31065 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
31068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
31069 LDKAcceptChannel this_ptr_conv;
31070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31071 this_ptr_conv.is_owned = false;
31072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31073 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31074 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
31078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31079 LDKAcceptChannel this_ptr_conv;
31080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31081 this_ptr_conv.is_owned = false;
31082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31083 LDKPublicKey val_ref;
31084 CHECK((*env)->GetArrayLength(env, val) == 33);
31085 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31086 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
31089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31090 LDKAcceptChannel this_ptr_conv;
31091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31092 this_ptr_conv.is_owned = false;
31093 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31094 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31095 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
31099 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) {
31100 LDKAcceptChannel this_ptr_conv;
31101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31102 this_ptr_conv.is_owned = false;
31103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31104 LDKPublicKey val_ref;
31105 CHECK((*env)->GetArrayLength(env, val) == 33);
31106 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31107 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
31110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
31111 LDKAcceptChannel this_ptr_conv;
31112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31113 this_ptr_conv.is_owned = false;
31114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31115 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
31116 int64_t ret_ref = 0;
31117 if ((uintptr_t)ret_var.inner > 4096) {
31118 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31119 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31120 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31121 ret_ref = (uintptr_t)ret_var.inner;
31122 if (ret_var.is_owned) {
31129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31130 LDKAcceptChannel this_ptr_conv;
31131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31132 this_ptr_conv.is_owned = false;
31133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31134 LDKChannelTypeFeatures val_conv;
31135 val_conv.inner = (void*)(val & (~1));
31136 val_conv.is_owned = (val & 1) || (val == 0);
31137 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31138 val_conv = ChannelTypeFeatures_clone(&val_conv);
31139 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
31142 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
31143 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
31144 int64_t ret_ref = 0;
31145 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31146 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31147 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31148 ret_ref = (uintptr_t)ret_var.inner;
31149 if (ret_var.is_owned) {
31154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31155 LDKAcceptChannel arg_conv;
31156 arg_conv.inner = (void*)(arg & (~1));
31157 arg_conv.is_owned = false;
31158 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31159 int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
31163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31164 LDKAcceptChannel orig_conv;
31165 orig_conv.inner = (void*)(orig & (~1));
31166 orig_conv.is_owned = false;
31167 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31168 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
31169 int64_t ret_ref = 0;
31170 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31171 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31173 ret_ref = (uintptr_t)ret_var.inner;
31174 if (ret_var.is_owned) {
31180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31181 LDKFundingCreated this_obj_conv;
31182 this_obj_conv.inner = (void*)(this_obj & (~1));
31183 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31185 FundingCreated_free(this_obj_conv);
31188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31189 LDKFundingCreated this_ptr_conv;
31190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31191 this_ptr_conv.is_owned = false;
31192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31193 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31194 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
31198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31199 LDKFundingCreated this_ptr_conv;
31200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31201 this_ptr_conv.is_owned = false;
31202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31203 LDKThirtyTwoBytes val_ref;
31204 CHECK((*env)->GetArrayLength(env, val) == 32);
31205 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31206 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
31209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
31210 LDKFundingCreated this_ptr_conv;
31211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31212 this_ptr_conv.is_owned = false;
31213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31214 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31215 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
31219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31220 LDKFundingCreated this_ptr_conv;
31221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31222 this_ptr_conv.is_owned = false;
31223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31224 LDKThirtyTwoBytes val_ref;
31225 CHECK((*env)->GetArrayLength(env, val) == 32);
31226 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31227 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
31230 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
31231 LDKFundingCreated this_ptr_conv;
31232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31233 this_ptr_conv.is_owned = false;
31234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31235 int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
31239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31240 LDKFundingCreated this_ptr_conv;
31241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31242 this_ptr_conv.is_owned = false;
31243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31244 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31248 LDKFundingCreated this_ptr_conv;
31249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31250 this_ptr_conv.is_owned = false;
31251 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31252 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31253 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
31257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31258 LDKFundingCreated 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 LDKSignature val_ref;
31263 CHECK((*env)->GetArrayLength(env, val) == 64);
31264 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31265 FundingCreated_set_signature(&this_ptr_conv, val_ref);
31268 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) {
31269 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31270 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
31271 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
31272 LDKThirtyTwoBytes funding_txid_arg_ref;
31273 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
31274 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
31275 LDKSignature signature_arg_ref;
31276 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31277 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31278 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31279 int64_t ret_ref = 0;
31280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31283 ret_ref = (uintptr_t)ret_var.inner;
31284 if (ret_var.is_owned) {
31290 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31291 LDKFundingCreated ret_var = FundingCreated_clone(arg);
31292 int64_t ret_ref = 0;
31293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31296 ret_ref = (uintptr_t)ret_var.inner;
31297 if (ret_var.is_owned) {
31302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31303 LDKFundingCreated arg_conv;
31304 arg_conv.inner = (void*)(arg & (~1));
31305 arg_conv.is_owned = false;
31306 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31307 int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31312 LDKFundingCreated orig_conv;
31313 orig_conv.inner = (void*)(orig & (~1));
31314 orig_conv.is_owned = false;
31315 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31316 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31317 int64_t ret_ref = 0;
31318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31321 ret_ref = (uintptr_t)ret_var.inner;
31322 if (ret_var.is_owned) {
31328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31329 LDKFundingSigned this_obj_conv;
31330 this_obj_conv.inner = (void*)(this_obj & (~1));
31331 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31333 FundingSigned_free(this_obj_conv);
31336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31337 LDKFundingSigned this_ptr_conv;
31338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31339 this_ptr_conv.is_owned = false;
31340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31341 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31342 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
31346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31347 LDKFundingSigned this_ptr_conv;
31348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31349 this_ptr_conv.is_owned = false;
31350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31351 LDKThirtyTwoBytes val_ref;
31352 CHECK((*env)->GetArrayLength(env, val) == 32);
31353 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31354 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31358 LDKFundingSigned this_ptr_conv;
31359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31360 this_ptr_conv.is_owned = false;
31361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31362 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31363 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
31367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31368 LDKFundingSigned this_ptr_conv;
31369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31370 this_ptr_conv.is_owned = false;
31371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31372 LDKSignature val_ref;
31373 CHECK((*env)->GetArrayLength(env, val) == 64);
31374 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31375 FundingSigned_set_signature(&this_ptr_conv, val_ref);
31378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
31379 LDKThirtyTwoBytes channel_id_arg_ref;
31380 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31381 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31382 LDKSignature signature_arg_ref;
31383 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31384 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31385 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31386 int64_t ret_ref = 0;
31387 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31388 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31389 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31390 ret_ref = (uintptr_t)ret_var.inner;
31391 if (ret_var.is_owned) {
31397 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31398 LDKFundingSigned ret_var = FundingSigned_clone(arg);
31399 int64_t ret_ref = 0;
31400 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31401 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31402 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31403 ret_ref = (uintptr_t)ret_var.inner;
31404 if (ret_var.is_owned) {
31409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31410 LDKFundingSigned arg_conv;
31411 arg_conv.inner = (void*)(arg & (~1));
31412 arg_conv.is_owned = false;
31413 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31414 int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
31418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31419 LDKFundingSigned orig_conv;
31420 orig_conv.inner = (void*)(orig & (~1));
31421 orig_conv.is_owned = false;
31422 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31423 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31424 int64_t ret_ref = 0;
31425 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31426 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31427 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31428 ret_ref = (uintptr_t)ret_var.inner;
31429 if (ret_var.is_owned) {
31435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31436 LDKFundingLocked this_obj_conv;
31437 this_obj_conv.inner = (void*)(this_obj & (~1));
31438 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31440 FundingLocked_free(this_obj_conv);
31443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31444 LDKFundingLocked this_ptr_conv;
31445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31446 this_ptr_conv.is_owned = false;
31447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31448 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31449 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
31453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31454 LDKFundingLocked this_ptr_conv;
31455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31456 this_ptr_conv.is_owned = false;
31457 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31458 LDKThirtyTwoBytes val_ref;
31459 CHECK((*env)->GetArrayLength(env, val) == 32);
31460 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31461 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
31464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
31465 LDKFundingLocked this_ptr_conv;
31466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31467 this_ptr_conv.is_owned = false;
31468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31469 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
31470 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
31474 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) {
31475 LDKFundingLocked this_ptr_conv;
31476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31477 this_ptr_conv.is_owned = false;
31478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31479 LDKPublicKey val_ref;
31480 CHECK((*env)->GetArrayLength(env, val) == 33);
31481 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
31482 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
31486 LDKFundingLocked this_ptr_conv;
31487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31488 this_ptr_conv.is_owned = false;
31489 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31490 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31491 *ret_copy = FundingLocked_get_short_channel_id_alias(&this_ptr_conv);
31492 int64_t ret_ref = (uintptr_t)ret_copy;
31496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31497 LDKFundingLocked this_ptr_conv;
31498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31499 this_ptr_conv.is_owned = false;
31500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31501 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
31502 CHECK_ACCESS(val_ptr);
31503 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31504 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
31505 FundingLocked_set_short_channel_id_alias(&this_ptr_conv, val_conv);
31508 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, int64_t short_channel_id_alias_arg) {
31509 LDKThirtyTwoBytes channel_id_arg_ref;
31510 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31511 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31512 LDKPublicKey next_per_commitment_point_arg_ref;
31513 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
31514 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
31515 void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1);
31516 CHECK_ACCESS(short_channel_id_alias_arg_ptr);
31517 LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
31518 short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1));
31519 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
31520 int64_t ret_ref = 0;
31521 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31522 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31523 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31524 ret_ref = (uintptr_t)ret_var.inner;
31525 if (ret_var.is_owned) {
31531 static inline uintptr_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
31532 LDKFundingLocked ret_var = FundingLocked_clone(arg);
31533 int64_t ret_ref = 0;
31534 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31535 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31536 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31537 ret_ref = (uintptr_t)ret_var.inner;
31538 if (ret_var.is_owned) {
31543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31544 LDKFundingLocked arg_conv;
31545 arg_conv.inner = (void*)(arg & (~1));
31546 arg_conv.is_owned = false;
31547 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31548 int64_t ret_conv = FundingLocked_clone_ptr(&arg_conv);
31552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31553 LDKFundingLocked orig_conv;
31554 orig_conv.inner = (void*)(orig & (~1));
31555 orig_conv.is_owned = false;
31556 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31557 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
31558 int64_t ret_ref = 0;
31559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31562 ret_ref = (uintptr_t)ret_var.inner;
31563 if (ret_var.is_owned) {
31569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31570 LDKShutdown this_obj_conv;
31571 this_obj_conv.inner = (void*)(this_obj & (~1));
31572 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31573 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31574 Shutdown_free(this_obj_conv);
31577 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31578 LDKShutdown this_ptr_conv;
31579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31580 this_ptr_conv.is_owned = false;
31581 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31582 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31583 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
31587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31588 LDKShutdown this_ptr_conv;
31589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31590 this_ptr_conv.is_owned = false;
31591 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31592 LDKThirtyTwoBytes val_ref;
31593 CHECK((*env)->GetArrayLength(env, val) == 32);
31594 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31595 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
31598 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31599 LDKShutdown this_ptr_conv;
31600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31601 this_ptr_conv.is_owned = false;
31602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31603 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
31604 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31605 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31610 LDKShutdown this_ptr_conv;
31611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31612 this_ptr_conv.is_owned = false;
31613 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31614 LDKCVec_u8Z val_ref;
31615 val_ref.datalen = (*env)->GetArrayLength(env, val);
31616 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31617 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
31618 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
31621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
31622 LDKThirtyTwoBytes channel_id_arg_ref;
31623 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31624 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31625 LDKCVec_u8Z scriptpubkey_arg_ref;
31626 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
31627 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31628 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
31629 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
31630 int64_t ret_ref = 0;
31631 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31632 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31633 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31634 ret_ref = (uintptr_t)ret_var.inner;
31635 if (ret_var.is_owned) {
31641 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
31642 LDKShutdown ret_var = Shutdown_clone(arg);
31643 int64_t ret_ref = 0;
31644 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31645 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31646 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31647 ret_ref = (uintptr_t)ret_var.inner;
31648 if (ret_var.is_owned) {
31653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31654 LDKShutdown arg_conv;
31655 arg_conv.inner = (void*)(arg & (~1));
31656 arg_conv.is_owned = false;
31657 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31658 int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
31662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31663 LDKShutdown orig_conv;
31664 orig_conv.inner = (void*)(orig & (~1));
31665 orig_conv.is_owned = false;
31666 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31667 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
31668 int64_t ret_ref = 0;
31669 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31670 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31671 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31672 ret_ref = (uintptr_t)ret_var.inner;
31673 if (ret_var.is_owned) {
31679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31680 LDKClosingSignedFeeRange this_obj_conv;
31681 this_obj_conv.inner = (void*)(this_obj & (~1));
31682 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31684 ClosingSignedFeeRange_free(this_obj_conv);
31687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31688 LDKClosingSignedFeeRange this_ptr_conv;
31689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31690 this_ptr_conv.is_owned = false;
31691 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31692 int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
31696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31697 LDKClosingSignedFeeRange this_ptr_conv;
31698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31699 this_ptr_conv.is_owned = false;
31700 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31701 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
31704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31705 LDKClosingSignedFeeRange this_ptr_conv;
31706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31707 this_ptr_conv.is_owned = false;
31708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31709 int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
31713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31714 LDKClosingSignedFeeRange this_ptr_conv;
31715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31716 this_ptr_conv.is_owned = false;
31717 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31718 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
31721 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) {
31722 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
31723 int64_t ret_ref = 0;
31724 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31725 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31726 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31727 ret_ref = (uintptr_t)ret_var.inner;
31728 if (ret_var.is_owned) {
31734 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
31735 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
31736 int64_t ret_ref = 0;
31737 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31738 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31739 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31740 ret_ref = (uintptr_t)ret_var.inner;
31741 if (ret_var.is_owned) {
31746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31747 LDKClosingSignedFeeRange arg_conv;
31748 arg_conv.inner = (void*)(arg & (~1));
31749 arg_conv.is_owned = false;
31750 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31751 int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
31755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31756 LDKClosingSignedFeeRange orig_conv;
31757 orig_conv.inner = (void*)(orig & (~1));
31758 orig_conv.is_owned = false;
31759 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31760 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
31761 int64_t ret_ref = 0;
31762 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31763 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31764 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31765 ret_ref = (uintptr_t)ret_var.inner;
31766 if (ret_var.is_owned) {
31772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31773 LDKClosingSigned this_obj_conv;
31774 this_obj_conv.inner = (void*)(this_obj & (~1));
31775 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31777 ClosingSigned_free(this_obj_conv);
31780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31781 LDKClosingSigned this_ptr_conv;
31782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31783 this_ptr_conv.is_owned = false;
31784 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31785 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31786 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
31790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31791 LDKClosingSigned this_ptr_conv;
31792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31793 this_ptr_conv.is_owned = false;
31794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31795 LDKThirtyTwoBytes val_ref;
31796 CHECK((*env)->GetArrayLength(env, val) == 32);
31797 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31798 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
31801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31802 LDKClosingSigned this_ptr_conv;
31803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31804 this_ptr_conv.is_owned = false;
31805 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31806 int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
31810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31811 LDKClosingSigned this_ptr_conv;
31812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31813 this_ptr_conv.is_owned = false;
31814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31815 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
31818 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31819 LDKClosingSigned this_ptr_conv;
31820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31821 this_ptr_conv.is_owned = false;
31822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31823 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31824 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
31828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31829 LDKClosingSigned this_ptr_conv;
31830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31831 this_ptr_conv.is_owned = false;
31832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31833 LDKSignature val_ref;
31834 CHECK((*env)->GetArrayLength(env, val) == 64);
31835 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31836 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
31839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
31840 LDKClosingSigned this_ptr_conv;
31841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31842 this_ptr_conv.is_owned = false;
31843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31844 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
31845 int64_t ret_ref = 0;
31846 if ((uintptr_t)ret_var.inner > 4096) {
31847 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31848 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31849 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31850 ret_ref = (uintptr_t)ret_var.inner;
31851 if (ret_var.is_owned) {
31858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31859 LDKClosingSigned this_ptr_conv;
31860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31861 this_ptr_conv.is_owned = false;
31862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31863 LDKClosingSignedFeeRange val_conv;
31864 val_conv.inner = (void*)(val & (~1));
31865 val_conv.is_owned = (val & 1) || (val == 0);
31866 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31867 val_conv = ClosingSignedFeeRange_clone(&val_conv);
31868 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
31871 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) {
31872 LDKThirtyTwoBytes channel_id_arg_ref;
31873 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31874 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31875 LDKSignature signature_arg_ref;
31876 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31877 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31878 LDKClosingSignedFeeRange fee_range_arg_conv;
31879 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
31880 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
31881 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
31882 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
31883 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
31884 int64_t ret_ref = 0;
31885 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31886 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31887 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31888 ret_ref = (uintptr_t)ret_var.inner;
31889 if (ret_var.is_owned) {
31895 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
31896 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
31897 int64_t ret_ref = 0;
31898 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31899 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31900 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31901 ret_ref = (uintptr_t)ret_var.inner;
31902 if (ret_var.is_owned) {
31907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31908 LDKClosingSigned arg_conv;
31909 arg_conv.inner = (void*)(arg & (~1));
31910 arg_conv.is_owned = false;
31911 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31912 int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
31916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31917 LDKClosingSigned orig_conv;
31918 orig_conv.inner = (void*)(orig & (~1));
31919 orig_conv.is_owned = false;
31920 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31921 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
31922 int64_t ret_ref = 0;
31923 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31924 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31925 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31926 ret_ref = (uintptr_t)ret_var.inner;
31927 if (ret_var.is_owned) {
31933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31934 LDKUpdateAddHTLC this_obj_conv;
31935 this_obj_conv.inner = (void*)(this_obj & (~1));
31936 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31938 UpdateAddHTLC_free(this_obj_conv);
31941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31942 LDKUpdateAddHTLC this_ptr_conv;
31943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31944 this_ptr_conv.is_owned = false;
31945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31946 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31947 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
31951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31952 LDKUpdateAddHTLC this_ptr_conv;
31953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31954 this_ptr_conv.is_owned = false;
31955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31956 LDKThirtyTwoBytes val_ref;
31957 CHECK((*env)->GetArrayLength(env, val) == 32);
31958 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31959 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
31962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31963 LDKUpdateAddHTLC this_ptr_conv;
31964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31965 this_ptr_conv.is_owned = false;
31966 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31967 int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
31971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31972 LDKUpdateAddHTLC this_ptr_conv;
31973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31974 this_ptr_conv.is_owned = false;
31975 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31976 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
31979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31980 LDKUpdateAddHTLC this_ptr_conv;
31981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31982 this_ptr_conv.is_owned = false;
31983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31984 int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
31988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31989 LDKUpdateAddHTLC this_ptr_conv;
31990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31991 this_ptr_conv.is_owned = false;
31992 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31993 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
31996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31997 LDKUpdateAddHTLC this_ptr_conv;
31998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31999 this_ptr_conv.is_owned = false;
32000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32001 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32002 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
32006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32007 LDKUpdateAddHTLC this_ptr_conv;
32008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32009 this_ptr_conv.is_owned = false;
32010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32011 LDKThirtyTwoBytes val_ref;
32012 CHECK((*env)->GetArrayLength(env, val) == 32);
32013 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32014 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
32017 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
32018 LDKUpdateAddHTLC this_ptr_conv;
32019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32020 this_ptr_conv.is_owned = false;
32021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32022 int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
32026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32027 LDKUpdateAddHTLC this_ptr_conv;
32028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32029 this_ptr_conv.is_owned = false;
32030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32031 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
32034 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
32035 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
32036 int64_t ret_ref = 0;
32037 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32038 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32040 ret_ref = (uintptr_t)ret_var.inner;
32041 if (ret_var.is_owned) {
32046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32047 LDKUpdateAddHTLC arg_conv;
32048 arg_conv.inner = (void*)(arg & (~1));
32049 arg_conv.is_owned = false;
32050 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32051 int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
32055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32056 LDKUpdateAddHTLC orig_conv;
32057 orig_conv.inner = (void*)(orig & (~1));
32058 orig_conv.is_owned = false;
32059 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32060 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
32061 int64_t ret_ref = 0;
32062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32065 ret_ref = (uintptr_t)ret_var.inner;
32066 if (ret_var.is_owned) {
32072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32073 LDKUpdateFulfillHTLC this_obj_conv;
32074 this_obj_conv.inner = (void*)(this_obj & (~1));
32075 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32077 UpdateFulfillHTLC_free(this_obj_conv);
32080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32081 LDKUpdateFulfillHTLC this_ptr_conv;
32082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32083 this_ptr_conv.is_owned = false;
32084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32085 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32086 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
32090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32091 LDKUpdateFulfillHTLC this_ptr_conv;
32092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32093 this_ptr_conv.is_owned = false;
32094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32095 LDKThirtyTwoBytes val_ref;
32096 CHECK((*env)->GetArrayLength(env, val) == 32);
32097 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32098 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
32101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32102 LDKUpdateFulfillHTLC this_ptr_conv;
32103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32104 this_ptr_conv.is_owned = false;
32105 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32106 int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
32110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32111 LDKUpdateFulfillHTLC this_ptr_conv;
32112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32113 this_ptr_conv.is_owned = false;
32114 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32115 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
32119 LDKUpdateFulfillHTLC this_ptr_conv;
32120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32121 this_ptr_conv.is_owned = false;
32122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32123 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32124 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
32128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32129 LDKUpdateFulfillHTLC this_ptr_conv;
32130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32131 this_ptr_conv.is_owned = false;
32132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32133 LDKThirtyTwoBytes val_ref;
32134 CHECK((*env)->GetArrayLength(env, val) == 32);
32135 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32136 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32139 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) {
32140 LDKThirtyTwoBytes channel_id_arg_ref;
32141 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32142 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32143 LDKThirtyTwoBytes payment_preimage_arg_ref;
32144 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
32145 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
32146 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32147 int64_t ret_ref = 0;
32148 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32149 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32151 ret_ref = (uintptr_t)ret_var.inner;
32152 if (ret_var.is_owned) {
32158 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32159 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32160 int64_t ret_ref = 0;
32161 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32162 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32164 ret_ref = (uintptr_t)ret_var.inner;
32165 if (ret_var.is_owned) {
32170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32171 LDKUpdateFulfillHTLC arg_conv;
32172 arg_conv.inner = (void*)(arg & (~1));
32173 arg_conv.is_owned = false;
32174 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32175 int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32180 LDKUpdateFulfillHTLC orig_conv;
32181 orig_conv.inner = (void*)(orig & (~1));
32182 orig_conv.is_owned = false;
32183 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32184 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32185 int64_t ret_ref = 0;
32186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32189 ret_ref = (uintptr_t)ret_var.inner;
32190 if (ret_var.is_owned) {
32196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32197 LDKUpdateFailHTLC this_obj_conv;
32198 this_obj_conv.inner = (void*)(this_obj & (~1));
32199 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32200 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32201 UpdateFailHTLC_free(this_obj_conv);
32204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32205 LDKUpdateFailHTLC this_ptr_conv;
32206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32207 this_ptr_conv.is_owned = false;
32208 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32209 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32210 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
32214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32215 LDKUpdateFailHTLC this_ptr_conv;
32216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32217 this_ptr_conv.is_owned = false;
32218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32219 LDKThirtyTwoBytes val_ref;
32220 CHECK((*env)->GetArrayLength(env, val) == 32);
32221 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32222 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32226 LDKUpdateFailHTLC this_ptr_conv;
32227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32228 this_ptr_conv.is_owned = false;
32229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32230 int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32235 LDKUpdateFailHTLC this_ptr_conv;
32236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32237 this_ptr_conv.is_owned = false;
32238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32239 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32242 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32243 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32244 int64_t ret_ref = 0;
32245 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32246 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32247 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32248 ret_ref = (uintptr_t)ret_var.inner;
32249 if (ret_var.is_owned) {
32254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32255 LDKUpdateFailHTLC arg_conv;
32256 arg_conv.inner = (void*)(arg & (~1));
32257 arg_conv.is_owned = false;
32258 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32259 int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32264 LDKUpdateFailHTLC orig_conv;
32265 orig_conv.inner = (void*)(orig & (~1));
32266 orig_conv.is_owned = false;
32267 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32268 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32269 int64_t ret_ref = 0;
32270 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32271 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32273 ret_ref = (uintptr_t)ret_var.inner;
32274 if (ret_var.is_owned) {
32280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32281 LDKUpdateFailMalformedHTLC this_obj_conv;
32282 this_obj_conv.inner = (void*)(this_obj & (~1));
32283 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32284 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32285 UpdateFailMalformedHTLC_free(this_obj_conv);
32288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32289 LDKUpdateFailMalformedHTLC this_ptr_conv;
32290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32291 this_ptr_conv.is_owned = false;
32292 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32293 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32294 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
32298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32299 LDKUpdateFailMalformedHTLC this_ptr_conv;
32300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32301 this_ptr_conv.is_owned = false;
32302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32303 LDKThirtyTwoBytes val_ref;
32304 CHECK((*env)->GetArrayLength(env, val) == 32);
32305 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32306 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32310 LDKUpdateFailMalformedHTLC this_ptr_conv;
32311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32312 this_ptr_conv.is_owned = false;
32313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32314 int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32319 LDKUpdateFailMalformedHTLC this_ptr_conv;
32320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32321 this_ptr_conv.is_owned = false;
32322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32323 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32326 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
32327 LDKUpdateFailMalformedHTLC this_ptr_conv;
32328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32329 this_ptr_conv.is_owned = false;
32330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32331 int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
32336 LDKUpdateFailMalformedHTLC this_ptr_conv;
32337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32338 this_ptr_conv.is_owned = false;
32339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32340 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32343 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32344 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32345 int64_t ret_ref = 0;
32346 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32347 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32349 ret_ref = (uintptr_t)ret_var.inner;
32350 if (ret_var.is_owned) {
32355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32356 LDKUpdateFailMalformedHTLC arg_conv;
32357 arg_conv.inner = (void*)(arg & (~1));
32358 arg_conv.is_owned = false;
32359 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32360 int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32365 LDKUpdateFailMalformedHTLC orig_conv;
32366 orig_conv.inner = (void*)(orig & (~1));
32367 orig_conv.is_owned = false;
32368 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32369 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
32370 int64_t ret_ref = 0;
32371 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32372 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32374 ret_ref = (uintptr_t)ret_var.inner;
32375 if (ret_var.is_owned) {
32381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32382 LDKCommitmentSigned this_obj_conv;
32383 this_obj_conv.inner = (void*)(this_obj & (~1));
32384 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32385 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32386 CommitmentSigned_free(this_obj_conv);
32389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32390 LDKCommitmentSigned this_ptr_conv;
32391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32392 this_ptr_conv.is_owned = false;
32393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32394 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32395 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
32399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32400 LDKCommitmentSigned this_ptr_conv;
32401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32402 this_ptr_conv.is_owned = false;
32403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32404 LDKThirtyTwoBytes val_ref;
32405 CHECK((*env)->GetArrayLength(env, val) == 32);
32406 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32407 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
32410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32411 LDKCommitmentSigned this_ptr_conv;
32412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32413 this_ptr_conv.is_owned = false;
32414 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32415 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32416 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
32420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32421 LDKCommitmentSigned this_ptr_conv;
32422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32423 this_ptr_conv.is_owned = false;
32424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32425 LDKSignature val_ref;
32426 CHECK((*env)->GetArrayLength(env, val) == 64);
32427 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32428 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
32431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
32432 LDKCommitmentSigned this_ptr_conv;
32433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32434 this_ptr_conv.is_owned = false;
32435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32436 LDKCVec_SignatureZ val_constr;
32437 val_constr.datalen = (*env)->GetArrayLength(env, val);
32438 if (val_constr.datalen > 0)
32439 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32441 val_constr.data = NULL;
32442 for (size_t i = 0; i < val_constr.datalen; i++) {
32443 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
32444 LDKSignature val_conv_8_ref;
32445 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
32446 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
32447 val_constr.data[i] = val_conv_8_ref;
32449 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
32452 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) {
32453 LDKThirtyTwoBytes channel_id_arg_ref;
32454 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32455 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32456 LDKSignature signature_arg_ref;
32457 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32458 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32459 LDKCVec_SignatureZ htlc_signatures_arg_constr;
32460 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
32461 if (htlc_signatures_arg_constr.datalen > 0)
32462 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32464 htlc_signatures_arg_constr.data = NULL;
32465 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
32466 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
32467 LDKSignature htlc_signatures_arg_conv_8_ref;
32468 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
32469 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
32470 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
32472 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
32473 int64_t ret_ref = 0;
32474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32477 ret_ref = (uintptr_t)ret_var.inner;
32478 if (ret_var.is_owned) {
32484 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
32485 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
32486 int64_t ret_ref = 0;
32487 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32488 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32489 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32490 ret_ref = (uintptr_t)ret_var.inner;
32491 if (ret_var.is_owned) {
32496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32497 LDKCommitmentSigned arg_conv;
32498 arg_conv.inner = (void*)(arg & (~1));
32499 arg_conv.is_owned = false;
32500 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32501 int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
32505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32506 LDKCommitmentSigned orig_conv;
32507 orig_conv.inner = (void*)(orig & (~1));
32508 orig_conv.is_owned = false;
32509 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32510 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
32511 int64_t ret_ref = 0;
32512 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32513 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32514 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32515 ret_ref = (uintptr_t)ret_var.inner;
32516 if (ret_var.is_owned) {
32522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32523 LDKRevokeAndACK this_obj_conv;
32524 this_obj_conv.inner = (void*)(this_obj & (~1));
32525 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32527 RevokeAndACK_free(this_obj_conv);
32530 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32531 LDKRevokeAndACK this_ptr_conv;
32532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32533 this_ptr_conv.is_owned = false;
32534 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32535 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32536 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
32540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32541 LDKRevokeAndACK this_ptr_conv;
32542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32543 this_ptr_conv.is_owned = false;
32544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32545 LDKThirtyTwoBytes val_ref;
32546 CHECK((*env)->GetArrayLength(env, val) == 32);
32547 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32548 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
32551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
32552 LDKRevokeAndACK this_ptr_conv;
32553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32554 this_ptr_conv.is_owned = false;
32555 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32556 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32557 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
32561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32562 LDKRevokeAndACK this_ptr_conv;
32563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32564 this_ptr_conv.is_owned = false;
32565 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32566 LDKThirtyTwoBytes val_ref;
32567 CHECK((*env)->GetArrayLength(env, val) == 32);
32568 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32569 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
32572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32573 LDKRevokeAndACK this_ptr_conv;
32574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32575 this_ptr_conv.is_owned = false;
32576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32577 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32578 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
32582 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) {
32583 LDKRevokeAndACK this_ptr_conv;
32584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32585 this_ptr_conv.is_owned = false;
32586 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32587 LDKPublicKey val_ref;
32588 CHECK((*env)->GetArrayLength(env, val) == 33);
32589 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32590 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
32593 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) {
32594 LDKThirtyTwoBytes channel_id_arg_ref;
32595 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32596 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32597 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
32598 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
32599 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
32600 LDKPublicKey next_per_commitment_point_arg_ref;
32601 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
32602 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
32603 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
32604 int64_t ret_ref = 0;
32605 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32606 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32608 ret_ref = (uintptr_t)ret_var.inner;
32609 if (ret_var.is_owned) {
32615 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
32616 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
32617 int64_t ret_ref = 0;
32618 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32619 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32620 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32621 ret_ref = (uintptr_t)ret_var.inner;
32622 if (ret_var.is_owned) {
32627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32628 LDKRevokeAndACK arg_conv;
32629 arg_conv.inner = (void*)(arg & (~1));
32630 arg_conv.is_owned = false;
32631 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32632 int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
32636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32637 LDKRevokeAndACK orig_conv;
32638 orig_conv.inner = (void*)(orig & (~1));
32639 orig_conv.is_owned = false;
32640 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32641 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
32642 int64_t ret_ref = 0;
32643 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32644 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32645 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32646 ret_ref = (uintptr_t)ret_var.inner;
32647 if (ret_var.is_owned) {
32653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32654 LDKUpdateFee this_obj_conv;
32655 this_obj_conv.inner = (void*)(this_obj & (~1));
32656 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32658 UpdateFee_free(this_obj_conv);
32661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32662 LDKUpdateFee this_ptr_conv;
32663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32664 this_ptr_conv.is_owned = false;
32665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32666 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32667 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
32671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32672 LDKUpdateFee this_ptr_conv;
32673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32674 this_ptr_conv.is_owned = false;
32675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32676 LDKThirtyTwoBytes val_ref;
32677 CHECK((*env)->GetArrayLength(env, val) == 32);
32678 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32679 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
32682 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
32683 LDKUpdateFee this_ptr_conv;
32684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32685 this_ptr_conv.is_owned = false;
32686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32687 int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
32691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32692 LDKUpdateFee this_ptr_conv;
32693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32694 this_ptr_conv.is_owned = false;
32695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32696 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
32699 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) {
32700 LDKThirtyTwoBytes channel_id_arg_ref;
32701 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32702 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32703 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
32704 int64_t ret_ref = 0;
32705 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32706 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32708 ret_ref = (uintptr_t)ret_var.inner;
32709 if (ret_var.is_owned) {
32715 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
32716 LDKUpdateFee ret_var = UpdateFee_clone(arg);
32717 int64_t ret_ref = 0;
32718 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32719 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32721 ret_ref = (uintptr_t)ret_var.inner;
32722 if (ret_var.is_owned) {
32727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32728 LDKUpdateFee arg_conv;
32729 arg_conv.inner = (void*)(arg & (~1));
32730 arg_conv.is_owned = false;
32731 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32732 int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
32736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32737 LDKUpdateFee orig_conv;
32738 orig_conv.inner = (void*)(orig & (~1));
32739 orig_conv.is_owned = false;
32740 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32741 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
32742 int64_t ret_ref = 0;
32743 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32744 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32745 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32746 ret_ref = (uintptr_t)ret_var.inner;
32747 if (ret_var.is_owned) {
32753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32754 LDKDataLossProtect this_obj_conv;
32755 this_obj_conv.inner = (void*)(this_obj & (~1));
32756 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32758 DataLossProtect_free(this_obj_conv);
32761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
32762 LDKDataLossProtect this_ptr_conv;
32763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32764 this_ptr_conv.is_owned = false;
32765 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32766 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32767 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
32771 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) {
32772 LDKDataLossProtect this_ptr_conv;
32773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32774 this_ptr_conv.is_owned = false;
32775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32776 LDKThirtyTwoBytes val_ref;
32777 CHECK((*env)->GetArrayLength(env, val) == 32);
32778 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32779 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
32782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32783 LDKDataLossProtect this_ptr_conv;
32784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32785 this_ptr_conv.is_owned = false;
32786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32787 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32788 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
32792 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) {
32793 LDKDataLossProtect this_ptr_conv;
32794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32795 this_ptr_conv.is_owned = false;
32796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32797 LDKPublicKey val_ref;
32798 CHECK((*env)->GetArrayLength(env, val) == 33);
32799 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32800 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
32803 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) {
32804 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
32805 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
32806 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
32807 LDKPublicKey my_current_per_commitment_point_arg_ref;
32808 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
32809 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
32810 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
32811 int64_t ret_ref = 0;
32812 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32813 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32814 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32815 ret_ref = (uintptr_t)ret_var.inner;
32816 if (ret_var.is_owned) {
32822 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
32823 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
32824 int64_t ret_ref = 0;
32825 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32826 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32827 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32828 ret_ref = (uintptr_t)ret_var.inner;
32829 if (ret_var.is_owned) {
32834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32835 LDKDataLossProtect arg_conv;
32836 arg_conv.inner = (void*)(arg & (~1));
32837 arg_conv.is_owned = false;
32838 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32839 int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
32843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32844 LDKDataLossProtect orig_conv;
32845 orig_conv.inner = (void*)(orig & (~1));
32846 orig_conv.is_owned = false;
32847 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32848 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
32849 int64_t ret_ref = 0;
32850 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32851 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32852 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32853 ret_ref = (uintptr_t)ret_var.inner;
32854 if (ret_var.is_owned) {
32860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32861 LDKChannelReestablish this_obj_conv;
32862 this_obj_conv.inner = (void*)(this_obj & (~1));
32863 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32865 ChannelReestablish_free(this_obj_conv);
32868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32869 LDKChannelReestablish this_ptr_conv;
32870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32871 this_ptr_conv.is_owned = false;
32872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32873 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32874 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
32878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32879 LDKChannelReestablish this_ptr_conv;
32880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32881 this_ptr_conv.is_owned = false;
32882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32883 LDKThirtyTwoBytes val_ref;
32884 CHECK((*env)->GetArrayLength(env, val) == 32);
32885 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32886 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
32889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
32890 LDKChannelReestablish this_ptr_conv;
32891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32892 this_ptr_conv.is_owned = false;
32893 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32894 int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
32898 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) {
32899 LDKChannelReestablish this_ptr_conv;
32900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32901 this_ptr_conv.is_owned = false;
32902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32903 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
32906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
32907 LDKChannelReestablish this_ptr_conv;
32908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32909 this_ptr_conv.is_owned = false;
32910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32911 int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
32915 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) {
32916 LDKChannelReestablish this_ptr_conv;
32917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32918 this_ptr_conv.is_owned = false;
32919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32920 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
32923 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
32924 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
32925 int64_t ret_ref = 0;
32926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32929 ret_ref = (uintptr_t)ret_var.inner;
32930 if (ret_var.is_owned) {
32935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32936 LDKChannelReestablish arg_conv;
32937 arg_conv.inner = (void*)(arg & (~1));
32938 arg_conv.is_owned = false;
32939 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32940 int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
32944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32945 LDKChannelReestablish orig_conv;
32946 orig_conv.inner = (void*)(orig & (~1));
32947 orig_conv.is_owned = false;
32948 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32949 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
32950 int64_t ret_ref = 0;
32951 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32952 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32953 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32954 ret_ref = (uintptr_t)ret_var.inner;
32955 if (ret_var.is_owned) {
32961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32962 LDKAnnouncementSignatures this_obj_conv;
32963 this_obj_conv.inner = (void*)(this_obj & (~1));
32964 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32965 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32966 AnnouncementSignatures_free(this_obj_conv);
32969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32970 LDKAnnouncementSignatures this_ptr_conv;
32971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32972 this_ptr_conv.is_owned = false;
32973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32974 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32975 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
32979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32980 LDKAnnouncementSignatures this_ptr_conv;
32981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32982 this_ptr_conv.is_owned = false;
32983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32984 LDKThirtyTwoBytes val_ref;
32985 CHECK((*env)->GetArrayLength(env, val) == 32);
32986 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32987 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
32990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32991 LDKAnnouncementSignatures this_ptr_conv;
32992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32993 this_ptr_conv.is_owned = false;
32994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32995 int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
32999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33000 LDKAnnouncementSignatures this_ptr_conv;
33001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33002 this_ptr_conv.is_owned = false;
33003 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33004 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
33007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33008 LDKAnnouncementSignatures 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33013 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
33017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33018 LDKAnnouncementSignatures this_ptr_conv;
33019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33020 this_ptr_conv.is_owned = false;
33021 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33022 LDKSignature val_ref;
33023 CHECK((*env)->GetArrayLength(env, val) == 64);
33024 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33025 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33028 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33029 LDKAnnouncementSignatures this_ptr_conv;
33030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33031 this_ptr_conv.is_owned = false;
33032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33033 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33034 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
33038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33039 LDKAnnouncementSignatures this_ptr_conv;
33040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33041 this_ptr_conv.is_owned = false;
33042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33043 LDKSignature val_ref;
33044 CHECK((*env)->GetArrayLength(env, val) == 64);
33045 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33046 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33049 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) {
33050 LDKThirtyTwoBytes channel_id_arg_ref;
33051 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
33052 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
33053 LDKSignature node_signature_arg_ref;
33054 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
33055 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
33056 LDKSignature bitcoin_signature_arg_ref;
33057 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
33058 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
33059 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33060 int64_t ret_ref = 0;
33061 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33062 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33063 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33064 ret_ref = (uintptr_t)ret_var.inner;
33065 if (ret_var.is_owned) {
33071 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33072 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33073 int64_t ret_ref = 0;
33074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33075 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
33078 if (ret_var.is_owned) {
33083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33084 LDKAnnouncementSignatures arg_conv;
33085 arg_conv.inner = (void*)(arg & (~1));
33086 arg_conv.is_owned = false;
33087 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33088 int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33093 LDKAnnouncementSignatures orig_conv;
33094 orig_conv.inner = (void*)(orig & (~1));
33095 orig_conv.is_owned = false;
33096 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33097 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33098 int64_t ret_ref = 0;
33099 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33100 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33101 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33102 ret_ref = (uintptr_t)ret_var.inner;
33103 if (ret_var.is_owned) {
33109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
33110 if ((this_ptr & 1) != 0) return;
33111 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
33112 CHECK_ACCESS(this_ptr_ptr);
33113 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33114 FREE((void*)this_ptr);
33115 NetAddress_free(this_ptr_conv);
33118 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33119 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33120 *ret_copy = NetAddress_clone(arg);
33121 int64_t ret_ref = (uintptr_t)ret_copy;
33124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33125 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
33126 int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33131 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
33132 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33133 *ret_copy = NetAddress_clone(orig_conv);
33134 int64_t ret_ref = (uintptr_t)ret_copy;
33138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33139 LDKFourBytes addr_ref;
33140 CHECK((*env)->GetArrayLength(env, addr) == 4);
33141 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
33142 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33143 *ret_copy = NetAddress_ipv4(addr_ref, port);
33144 int64_t ret_ref = (uintptr_t)ret_copy;
33148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
33149 LDKSixteenBytes addr_ref;
33150 CHECK((*env)->GetArrayLength(env, addr) == 16);
33151 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
33152 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33153 *ret_copy = NetAddress_ipv6(addr_ref, port);
33154 int64_t ret_ref = (uintptr_t)ret_copy;
33158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
33159 LDKTwelveBytes a_ref;
33160 CHECK((*env)->GetArrayLength(env, a) == 12);
33161 (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
33162 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33163 *ret_copy = NetAddress_onion_v2(a_ref);
33164 int64_t ret_ref = (uintptr_t)ret_copy;
33168 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) {
33169 LDKThirtyTwoBytes ed25519_pubkey_ref;
33170 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
33171 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
33172 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33173 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33174 int64_t ret_ref = (uintptr_t)ret_copy;
33178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
33179 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
33180 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33181 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
33182 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
33183 CVec_u8Z_free(ret_var);
33187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
33188 LDKu8slice ser_ref;
33189 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
33190 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
33191 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33192 *ret_conv = NetAddress_read(ser_ref);
33193 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
33194 return (int64_t)ret_conv;
33197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33198 LDKUnsignedNodeAnnouncement this_obj_conv;
33199 this_obj_conv.inner = (void*)(this_obj & (~1));
33200 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33202 UnsignedNodeAnnouncement_free(this_obj_conv);
33205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
33206 LDKUnsignedNodeAnnouncement this_ptr_conv;
33207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33208 this_ptr_conv.is_owned = false;
33209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33210 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33211 int64_t ret_ref = 0;
33212 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33213 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33214 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33215 ret_ref = (uintptr_t)ret_var.inner;
33216 if (ret_var.is_owned) {
33222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33223 LDKUnsignedNodeAnnouncement this_ptr_conv;
33224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33225 this_ptr_conv.is_owned = false;
33226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33227 LDKNodeFeatures val_conv;
33228 val_conv.inner = (void*)(val & (~1));
33229 val_conv.is_owned = (val & 1) || (val == 0);
33230 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33231 val_conv = NodeFeatures_clone(&val_conv);
33232 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33235 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
33236 LDKUnsignedNodeAnnouncement this_ptr_conv;
33237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33238 this_ptr_conv.is_owned = false;
33239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33240 int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33245 LDKUnsignedNodeAnnouncement this_ptr_conv;
33246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33247 this_ptr_conv.is_owned = false;
33248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33249 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33252 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33253 LDKUnsignedNodeAnnouncement this_ptr_conv;
33254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33255 this_ptr_conv.is_owned = false;
33256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33257 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33258 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
33262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33263 LDKUnsignedNodeAnnouncement this_ptr_conv;
33264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33265 this_ptr_conv.is_owned = false;
33266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33267 LDKPublicKey val_ref;
33268 CHECK((*env)->GetArrayLength(env, val) == 33);
33269 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33270 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
33273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
33274 LDKUnsignedNodeAnnouncement this_ptr_conv;
33275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33276 this_ptr_conv.is_owned = false;
33277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33278 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
33279 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
33283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33284 LDKUnsignedNodeAnnouncement this_ptr_conv;
33285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33286 this_ptr_conv.is_owned = false;
33287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33288 LDKThreeBytes val_ref;
33289 CHECK((*env)->GetArrayLength(env, val) == 3);
33290 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
33291 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
33294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
33295 LDKUnsignedNodeAnnouncement this_ptr_conv;
33296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33297 this_ptr_conv.is_owned = false;
33298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33299 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33300 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
33304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33305 LDKUnsignedNodeAnnouncement this_ptr_conv;
33306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33307 this_ptr_conv.is_owned = false;
33308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33309 LDKThirtyTwoBytes val_ref;
33310 CHECK((*env)->GetArrayLength(env, val) == 32);
33311 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33312 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
33315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
33316 LDKUnsignedNodeAnnouncement this_ptr_conv;
33317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33318 this_ptr_conv.is_owned = false;
33319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33320 LDKCVec_NetAddressZ val_constr;
33321 val_constr.datalen = (*env)->GetArrayLength(env, val);
33322 if (val_constr.datalen > 0)
33323 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
33325 val_constr.data = NULL;
33326 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
33327 for (size_t m = 0; m < val_constr.datalen; m++) {
33328 int64_t val_conv_12 = val_vals[m];
33329 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
33330 CHECK_ACCESS(val_conv_12_ptr);
33331 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
33332 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
33333 val_constr.data[m] = val_conv_12_conv;
33335 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
33336 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
33339 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
33340 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
33341 int64_t ret_ref = 0;
33342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33345 ret_ref = (uintptr_t)ret_var.inner;
33346 if (ret_var.is_owned) {
33351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33352 LDKUnsignedNodeAnnouncement arg_conv;
33353 arg_conv.inner = (void*)(arg & (~1));
33354 arg_conv.is_owned = false;
33355 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33356 int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
33360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33361 LDKUnsignedNodeAnnouncement orig_conv;
33362 orig_conv.inner = (void*)(orig & (~1));
33363 orig_conv.is_owned = false;
33364 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33365 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
33366 int64_t ret_ref = 0;
33367 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33368 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33369 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33370 ret_ref = (uintptr_t)ret_var.inner;
33371 if (ret_var.is_owned) {
33377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33378 LDKNodeAnnouncement this_obj_conv;
33379 this_obj_conv.inner = (void*)(this_obj & (~1));
33380 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33382 NodeAnnouncement_free(this_obj_conv);
33385 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33386 LDKNodeAnnouncement this_ptr_conv;
33387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33388 this_ptr_conv.is_owned = false;
33389 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33390 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33391 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
33395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33396 LDKNodeAnnouncement this_ptr_conv;
33397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33398 this_ptr_conv.is_owned = false;
33399 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33400 LDKSignature val_ref;
33401 CHECK((*env)->GetArrayLength(env, val) == 64);
33402 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33403 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
33406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
33407 LDKNodeAnnouncement this_ptr_conv;
33408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33409 this_ptr_conv.is_owned = false;
33410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33411 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
33412 int64_t ret_ref = 0;
33413 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33414 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33416 ret_ref = (uintptr_t)ret_var.inner;
33417 if (ret_var.is_owned) {
33423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33424 LDKNodeAnnouncement this_ptr_conv;
33425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33426 this_ptr_conv.is_owned = false;
33427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33428 LDKUnsignedNodeAnnouncement val_conv;
33429 val_conv.inner = (void*)(val & (~1));
33430 val_conv.is_owned = (val & 1) || (val == 0);
33431 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33432 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
33433 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
33436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
33437 LDKSignature signature_arg_ref;
33438 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33439 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33440 LDKUnsignedNodeAnnouncement contents_arg_conv;
33441 contents_arg_conv.inner = (void*)(contents_arg & (~1));
33442 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
33443 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33444 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
33445 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
33446 int64_t ret_ref = 0;
33447 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33448 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33450 ret_ref = (uintptr_t)ret_var.inner;
33451 if (ret_var.is_owned) {
33457 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
33458 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
33459 int64_t ret_ref = 0;
33460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33463 ret_ref = (uintptr_t)ret_var.inner;
33464 if (ret_var.is_owned) {
33469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33470 LDKNodeAnnouncement arg_conv;
33471 arg_conv.inner = (void*)(arg & (~1));
33472 arg_conv.is_owned = false;
33473 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33474 int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
33478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33479 LDKNodeAnnouncement orig_conv;
33480 orig_conv.inner = (void*)(orig & (~1));
33481 orig_conv.is_owned = false;
33482 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33483 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
33484 int64_t ret_ref = 0;
33485 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33486 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33487 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33488 ret_ref = (uintptr_t)ret_var.inner;
33489 if (ret_var.is_owned) {
33495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33496 LDKUnsignedChannelAnnouncement this_obj_conv;
33497 this_obj_conv.inner = (void*)(this_obj & (~1));
33498 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33500 UnsignedChannelAnnouncement_free(this_obj_conv);
33503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
33504 LDKUnsignedChannelAnnouncement this_ptr_conv;
33505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33506 this_ptr_conv.is_owned = false;
33507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33508 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
33509 int64_t ret_ref = 0;
33510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33513 ret_ref = (uintptr_t)ret_var.inner;
33514 if (ret_var.is_owned) {
33520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33521 LDKUnsignedChannelAnnouncement this_ptr_conv;
33522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33523 this_ptr_conv.is_owned = false;
33524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33525 LDKChannelFeatures val_conv;
33526 val_conv.inner = (void*)(val & (~1));
33527 val_conv.is_owned = (val & 1) || (val == 0);
33528 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33529 val_conv = ChannelFeatures_clone(&val_conv);
33530 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
33533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33534 LDKUnsignedChannelAnnouncement this_ptr_conv;
33535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33536 this_ptr_conv.is_owned = false;
33537 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33538 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33539 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
33543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33544 LDKUnsignedChannelAnnouncement this_ptr_conv;
33545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33546 this_ptr_conv.is_owned = false;
33547 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33548 LDKThirtyTwoBytes val_ref;
33549 CHECK((*env)->GetArrayLength(env, val) == 32);
33550 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33551 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
33554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33555 LDKUnsignedChannelAnnouncement this_ptr_conv;
33556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33557 this_ptr_conv.is_owned = false;
33558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33559 int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
33563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33564 LDKUnsignedChannelAnnouncement this_ptr_conv;
33565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33566 this_ptr_conv.is_owned = false;
33567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33568 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
33571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33572 LDKUnsignedChannelAnnouncement this_ptr_conv;
33573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33574 this_ptr_conv.is_owned = false;
33575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33576 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33577 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
33581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33582 LDKUnsignedChannelAnnouncement this_ptr_conv;
33583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33584 this_ptr_conv.is_owned = false;
33585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33586 LDKPublicKey val_ref;
33587 CHECK((*env)->GetArrayLength(env, val) == 33);
33588 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33589 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
33592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33593 LDKUnsignedChannelAnnouncement this_ptr_conv;
33594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33595 this_ptr_conv.is_owned = false;
33596 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33597 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33598 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
33602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33603 LDKUnsignedChannelAnnouncement this_ptr_conv;
33604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33605 this_ptr_conv.is_owned = false;
33606 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33607 LDKPublicKey val_ref;
33608 CHECK((*env)->GetArrayLength(env, val) == 33);
33609 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33610 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
33613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33614 LDKUnsignedChannelAnnouncement this_ptr_conv;
33615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33616 this_ptr_conv.is_owned = false;
33617 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33618 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33619 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
33623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33624 LDKUnsignedChannelAnnouncement this_ptr_conv;
33625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33626 this_ptr_conv.is_owned = false;
33627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33628 LDKPublicKey val_ref;
33629 CHECK((*env)->GetArrayLength(env, val) == 33);
33630 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33631 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
33634 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33635 LDKUnsignedChannelAnnouncement this_ptr_conv;
33636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33637 this_ptr_conv.is_owned = false;
33638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33639 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33640 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
33644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33645 LDKUnsignedChannelAnnouncement this_ptr_conv;
33646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33647 this_ptr_conv.is_owned = false;
33648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33649 LDKPublicKey val_ref;
33650 CHECK((*env)->GetArrayLength(env, val) == 33);
33651 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33652 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
33655 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
33656 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
33657 int64_t ret_ref = 0;
33658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33661 ret_ref = (uintptr_t)ret_var.inner;
33662 if (ret_var.is_owned) {
33667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33668 LDKUnsignedChannelAnnouncement arg_conv;
33669 arg_conv.inner = (void*)(arg & (~1));
33670 arg_conv.is_owned = false;
33671 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33672 int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
33676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33677 LDKUnsignedChannelAnnouncement orig_conv;
33678 orig_conv.inner = (void*)(orig & (~1));
33679 orig_conv.is_owned = false;
33680 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33681 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
33682 int64_t ret_ref = 0;
33683 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33684 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33685 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33686 ret_ref = (uintptr_t)ret_var.inner;
33687 if (ret_var.is_owned) {
33693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33694 LDKChannelAnnouncement this_obj_conv;
33695 this_obj_conv.inner = (void*)(this_obj & (~1));
33696 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33698 ChannelAnnouncement_free(this_obj_conv);
33701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33702 LDKChannelAnnouncement this_ptr_conv;
33703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33704 this_ptr_conv.is_owned = false;
33705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33706 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33707 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
33711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33712 LDKChannelAnnouncement this_ptr_conv;
33713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33714 this_ptr_conv.is_owned = false;
33715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33716 LDKSignature val_ref;
33717 CHECK((*env)->GetArrayLength(env, val) == 64);
33718 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33719 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
33722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33723 LDKChannelAnnouncement this_ptr_conv;
33724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33725 this_ptr_conv.is_owned = false;
33726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33727 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33728 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
33732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33733 LDKChannelAnnouncement this_ptr_conv;
33734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33735 this_ptr_conv.is_owned = false;
33736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33737 LDKSignature val_ref;
33738 CHECK((*env)->GetArrayLength(env, val) == 64);
33739 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33740 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
33743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33744 LDKChannelAnnouncement this_ptr_conv;
33745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33746 this_ptr_conv.is_owned = false;
33747 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33748 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33749 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
33753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33754 LDKChannelAnnouncement this_ptr_conv;
33755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33756 this_ptr_conv.is_owned = false;
33757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33758 LDKSignature val_ref;
33759 CHECK((*env)->GetArrayLength(env, val) == 64);
33760 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33761 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
33764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33765 LDKChannelAnnouncement this_ptr_conv;
33766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33767 this_ptr_conv.is_owned = false;
33768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33769 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33770 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
33774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33775 LDKChannelAnnouncement this_ptr_conv;
33776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33777 this_ptr_conv.is_owned = false;
33778 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33779 LDKSignature val_ref;
33780 CHECK((*env)->GetArrayLength(env, val) == 64);
33781 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33782 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
33785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
33786 LDKChannelAnnouncement this_ptr_conv;
33787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33788 this_ptr_conv.is_owned = false;
33789 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33790 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
33791 int64_t ret_ref = 0;
33792 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33793 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33795 ret_ref = (uintptr_t)ret_var.inner;
33796 if (ret_var.is_owned) {
33802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33803 LDKChannelAnnouncement this_ptr_conv;
33804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33805 this_ptr_conv.is_owned = false;
33806 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33807 LDKUnsignedChannelAnnouncement val_conv;
33808 val_conv.inner = (void*)(val & (~1));
33809 val_conv.is_owned = (val & 1) || (val == 0);
33810 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33811 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
33812 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
33815 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) {
33816 LDKSignature node_signature_1_arg_ref;
33817 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
33818 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
33819 LDKSignature node_signature_2_arg_ref;
33820 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
33821 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
33822 LDKSignature bitcoin_signature_1_arg_ref;
33823 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
33824 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
33825 LDKSignature bitcoin_signature_2_arg_ref;
33826 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
33827 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
33828 LDKUnsignedChannelAnnouncement contents_arg_conv;
33829 contents_arg_conv.inner = (void*)(contents_arg & (~1));
33830 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
33831 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33832 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
33833 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);
33834 int64_t ret_ref = 0;
33835 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33836 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33838 ret_ref = (uintptr_t)ret_var.inner;
33839 if (ret_var.is_owned) {
33845 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
33846 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
33847 int64_t ret_ref = 0;
33848 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33849 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33850 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33851 ret_ref = (uintptr_t)ret_var.inner;
33852 if (ret_var.is_owned) {
33857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33858 LDKChannelAnnouncement arg_conv;
33859 arg_conv.inner = (void*)(arg & (~1));
33860 arg_conv.is_owned = false;
33861 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33862 int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
33866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33867 LDKChannelAnnouncement orig_conv;
33868 orig_conv.inner = (void*)(orig & (~1));
33869 orig_conv.is_owned = false;
33870 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33871 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
33872 int64_t ret_ref = 0;
33873 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33874 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33875 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33876 ret_ref = (uintptr_t)ret_var.inner;
33877 if (ret_var.is_owned) {
33883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33884 LDKUnsignedChannelUpdate this_obj_conv;
33885 this_obj_conv.inner = (void*)(this_obj & (~1));
33886 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33888 UnsignedChannelUpdate_free(this_obj_conv);
33891 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33892 LDKUnsignedChannelUpdate this_ptr_conv;
33893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33894 this_ptr_conv.is_owned = false;
33895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33896 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33897 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
33901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33902 LDKUnsignedChannelUpdate this_ptr_conv;
33903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33904 this_ptr_conv.is_owned = false;
33905 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33906 LDKThirtyTwoBytes val_ref;
33907 CHECK((*env)->GetArrayLength(env, val) == 32);
33908 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33909 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
33912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33913 LDKUnsignedChannelUpdate this_ptr_conv;
33914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33915 this_ptr_conv.is_owned = false;
33916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33917 int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
33921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33922 LDKUnsignedChannelUpdate this_ptr_conv;
33923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33924 this_ptr_conv.is_owned = false;
33925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33926 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
33929 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
33930 LDKUnsignedChannelUpdate this_ptr_conv;
33931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33932 this_ptr_conv.is_owned = false;
33933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33934 int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
33938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33939 LDKUnsignedChannelUpdate 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 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
33946 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
33947 LDKUnsignedChannelUpdate this_ptr_conv;
33948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33949 this_ptr_conv.is_owned = false;
33950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33951 int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
33955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
33956 LDKUnsignedChannelUpdate this_ptr_conv;
33957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33958 this_ptr_conv.is_owned = false;
33959 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33960 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
33963 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
33964 LDKUnsignedChannelUpdate this_ptr_conv;
33965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33966 this_ptr_conv.is_owned = false;
33967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33968 int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
33972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33973 LDKUnsignedChannelUpdate this_ptr_conv;
33974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33975 this_ptr_conv.is_owned = false;
33976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33977 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
33980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33981 LDKUnsignedChannelUpdate this_ptr_conv;
33982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33983 this_ptr_conv.is_owned = false;
33984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33985 int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
33989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33990 LDKUnsignedChannelUpdate this_ptr_conv;
33991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33992 this_ptr_conv.is_owned = false;
33993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33994 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
33997 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33998 LDKUnsignedChannelUpdate this_ptr_conv;
33999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34000 this_ptr_conv.is_owned = false;
34001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34002 int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34007 LDKUnsignedChannelUpdate this_ptr_conv;
34008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34009 this_ptr_conv.is_owned = false;
34010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34011 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34014 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
34015 LDKUnsignedChannelUpdate this_ptr_conv;
34016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34017 this_ptr_conv.is_owned = false;
34018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34019 int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34024 LDKUnsignedChannelUpdate this_ptr_conv;
34025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34026 this_ptr_conv.is_owned = false;
34027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34028 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34031 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34032 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34033 int64_t ret_ref = 0;
34034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34037 ret_ref = (uintptr_t)ret_var.inner;
34038 if (ret_var.is_owned) {
34043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34044 LDKUnsignedChannelUpdate arg_conv;
34045 arg_conv.inner = (void*)(arg & (~1));
34046 arg_conv.is_owned = false;
34047 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34048 int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34053 LDKUnsignedChannelUpdate orig_conv;
34054 orig_conv.inner = (void*)(orig & (~1));
34055 orig_conv.is_owned = false;
34056 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34057 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
34058 int64_t ret_ref = 0;
34059 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34060 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34061 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34062 ret_ref = (uintptr_t)ret_var.inner;
34063 if (ret_var.is_owned) {
34069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34070 LDKChannelUpdate this_obj_conv;
34071 this_obj_conv.inner = (void*)(this_obj & (~1));
34072 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34074 ChannelUpdate_free(this_obj_conv);
34077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
34078 LDKChannelUpdate this_ptr_conv;
34079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34080 this_ptr_conv.is_owned = false;
34081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34082 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
34083 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
34087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34088 LDKChannelUpdate this_ptr_conv;
34089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34090 this_ptr_conv.is_owned = false;
34091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34092 LDKSignature val_ref;
34093 CHECK((*env)->GetArrayLength(env, val) == 64);
34094 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
34095 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
34099 LDKChannelUpdate this_ptr_conv;
34100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34101 this_ptr_conv.is_owned = false;
34102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34103 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34104 int64_t ret_ref = 0;
34105 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34106 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34108 ret_ref = (uintptr_t)ret_var.inner;
34109 if (ret_var.is_owned) {
34115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34116 LDKChannelUpdate this_ptr_conv;
34117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34118 this_ptr_conv.is_owned = false;
34119 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34120 LDKUnsignedChannelUpdate val_conv;
34121 val_conv.inner = (void*)(val & (~1));
34122 val_conv.is_owned = (val & 1) || (val == 0);
34123 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34124 val_conv = UnsignedChannelUpdate_clone(&val_conv);
34125 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
34128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
34129 LDKSignature signature_arg_ref;
34130 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
34131 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
34132 LDKUnsignedChannelUpdate contents_arg_conv;
34133 contents_arg_conv.inner = (void*)(contents_arg & (~1));
34134 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
34135 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34136 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
34137 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
34138 int64_t ret_ref = 0;
34139 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34140 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34141 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34142 ret_ref = (uintptr_t)ret_var.inner;
34143 if (ret_var.is_owned) {
34149 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
34150 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
34151 int64_t ret_ref = 0;
34152 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34153 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34155 ret_ref = (uintptr_t)ret_var.inner;
34156 if (ret_var.is_owned) {
34161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34162 LDKChannelUpdate arg_conv;
34163 arg_conv.inner = (void*)(arg & (~1));
34164 arg_conv.is_owned = false;
34165 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34166 int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
34170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34171 LDKChannelUpdate orig_conv;
34172 orig_conv.inner = (void*)(orig & (~1));
34173 orig_conv.is_owned = false;
34174 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34175 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
34176 int64_t ret_ref = 0;
34177 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34178 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34179 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34180 ret_ref = (uintptr_t)ret_var.inner;
34181 if (ret_var.is_owned) {
34187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34188 LDKQueryChannelRange this_obj_conv;
34189 this_obj_conv.inner = (void*)(this_obj & (~1));
34190 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34191 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34192 QueryChannelRange_free(this_obj_conv);
34195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34196 LDKQueryChannelRange this_ptr_conv;
34197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34198 this_ptr_conv.is_owned = false;
34199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34200 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34201 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
34205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34206 LDKQueryChannelRange this_ptr_conv;
34207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34208 this_ptr_conv.is_owned = false;
34209 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34210 LDKThirtyTwoBytes val_ref;
34211 CHECK((*env)->GetArrayLength(env, val) == 32);
34212 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34213 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34216 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
34217 LDKQueryChannelRange this_ptr_conv;
34218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34219 this_ptr_conv.is_owned = false;
34220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34221 int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
34225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34226 LDKQueryChannelRange this_ptr_conv;
34227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34228 this_ptr_conv.is_owned = false;
34229 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34230 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
34233 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
34234 LDKQueryChannelRange this_ptr_conv;
34235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34236 this_ptr_conv.is_owned = false;
34237 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34238 int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
34242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34243 LDKQueryChannelRange this_ptr_conv;
34244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34245 this_ptr_conv.is_owned = false;
34246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34247 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34250 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) {
34251 LDKThirtyTwoBytes chain_hash_arg_ref;
34252 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34253 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34254 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
34255 int64_t ret_ref = 0;
34256 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34257 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34259 ret_ref = (uintptr_t)ret_var.inner;
34260 if (ret_var.is_owned) {
34266 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
34267 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
34268 int64_t ret_ref = 0;
34269 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34270 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34271 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34272 ret_ref = (uintptr_t)ret_var.inner;
34273 if (ret_var.is_owned) {
34278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34279 LDKQueryChannelRange arg_conv;
34280 arg_conv.inner = (void*)(arg & (~1));
34281 arg_conv.is_owned = false;
34282 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34283 int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
34287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34288 LDKQueryChannelRange orig_conv;
34289 orig_conv.inner = (void*)(orig & (~1));
34290 orig_conv.is_owned = false;
34291 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34292 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
34293 int64_t ret_ref = 0;
34294 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34295 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34296 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34297 ret_ref = (uintptr_t)ret_var.inner;
34298 if (ret_var.is_owned) {
34304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34305 LDKReplyChannelRange this_obj_conv;
34306 this_obj_conv.inner = (void*)(this_obj & (~1));
34307 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34309 ReplyChannelRange_free(this_obj_conv);
34312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34313 LDKReplyChannelRange this_ptr_conv;
34314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34315 this_ptr_conv.is_owned = false;
34316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34317 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34318 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
34322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34323 LDKReplyChannelRange this_ptr_conv;
34324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34325 this_ptr_conv.is_owned = false;
34326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34327 LDKThirtyTwoBytes val_ref;
34328 CHECK((*env)->GetArrayLength(env, val) == 32);
34329 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34330 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34333 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
34334 LDKReplyChannelRange this_ptr_conv;
34335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34336 this_ptr_conv.is_owned = false;
34337 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34338 int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
34342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34343 LDKReplyChannelRange this_ptr_conv;
34344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34345 this_ptr_conv.is_owned = false;
34346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34347 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
34350 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
34351 LDKReplyChannelRange this_ptr_conv;
34352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34353 this_ptr_conv.is_owned = false;
34354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34355 int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
34359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34360 LDKReplyChannelRange this_ptr_conv;
34361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34362 this_ptr_conv.is_owned = false;
34363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34364 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
34368 LDKReplyChannelRange this_ptr_conv;
34369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34370 this_ptr_conv.is_owned = false;
34371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34372 jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
34376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34377 LDKReplyChannelRange this_ptr_conv;
34378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34379 this_ptr_conv.is_owned = false;
34380 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34381 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
34384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34385 LDKReplyChannelRange this_ptr_conv;
34386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34387 this_ptr_conv.is_owned = false;
34388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34389 LDKCVec_u64Z val_constr;
34390 val_constr.datalen = (*env)->GetArrayLength(env, val);
34391 if (val_constr.datalen > 0)
34392 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34394 val_constr.data = NULL;
34395 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34396 for (size_t g = 0; g < val_constr.datalen; g++) {
34397 int64_t val_conv_6 = val_vals[g];
34398 val_constr.data[g] = val_conv_6;
34400 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34401 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
34404 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) {
34405 LDKThirtyTwoBytes chain_hash_arg_ref;
34406 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34407 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34408 LDKCVec_u64Z short_channel_ids_arg_constr;
34409 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
34410 if (short_channel_ids_arg_constr.datalen > 0)
34411 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34413 short_channel_ids_arg_constr.data = NULL;
34414 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
34415 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
34416 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
34417 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
34419 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
34420 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
34421 int64_t ret_ref = 0;
34422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34425 ret_ref = (uintptr_t)ret_var.inner;
34426 if (ret_var.is_owned) {
34432 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
34433 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
34434 int64_t ret_ref = 0;
34435 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34436 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34438 ret_ref = (uintptr_t)ret_var.inner;
34439 if (ret_var.is_owned) {
34444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34445 LDKReplyChannelRange arg_conv;
34446 arg_conv.inner = (void*)(arg & (~1));
34447 arg_conv.is_owned = false;
34448 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34449 int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
34453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34454 LDKReplyChannelRange orig_conv;
34455 orig_conv.inner = (void*)(orig & (~1));
34456 orig_conv.is_owned = false;
34457 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34458 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
34459 int64_t ret_ref = 0;
34460 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34461 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34462 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34463 ret_ref = (uintptr_t)ret_var.inner;
34464 if (ret_var.is_owned) {
34470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34471 LDKQueryShortChannelIds this_obj_conv;
34472 this_obj_conv.inner = (void*)(this_obj & (~1));
34473 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34474 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34475 QueryShortChannelIds_free(this_obj_conv);
34478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34479 LDKQueryShortChannelIds this_ptr_conv;
34480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34481 this_ptr_conv.is_owned = false;
34482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34483 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34484 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
34488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34489 LDKQueryShortChannelIds this_ptr_conv;
34490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34491 this_ptr_conv.is_owned = false;
34492 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34493 LDKThirtyTwoBytes val_ref;
34494 CHECK((*env)->GetArrayLength(env, val) == 32);
34495 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34496 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
34499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34500 LDKQueryShortChannelIds this_ptr_conv;
34501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34502 this_ptr_conv.is_owned = false;
34503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34504 LDKCVec_u64Z val_constr;
34505 val_constr.datalen = (*env)->GetArrayLength(env, val);
34506 if (val_constr.datalen > 0)
34507 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34509 val_constr.data = NULL;
34510 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34511 for (size_t g = 0; g < val_constr.datalen; g++) {
34512 int64_t val_conv_6 = val_vals[g];
34513 val_constr.data[g] = val_conv_6;
34515 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34516 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
34519 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) {
34520 LDKThirtyTwoBytes chain_hash_arg_ref;
34521 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34522 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34523 LDKCVec_u64Z short_channel_ids_arg_constr;
34524 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
34525 if (short_channel_ids_arg_constr.datalen > 0)
34526 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34528 short_channel_ids_arg_constr.data = NULL;
34529 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
34530 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
34531 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
34532 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
34534 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
34535 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
34536 int64_t ret_ref = 0;
34537 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34538 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34539 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34540 ret_ref = (uintptr_t)ret_var.inner;
34541 if (ret_var.is_owned) {
34547 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
34548 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
34549 int64_t ret_ref = 0;
34550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34553 ret_ref = (uintptr_t)ret_var.inner;
34554 if (ret_var.is_owned) {
34559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34560 LDKQueryShortChannelIds arg_conv;
34561 arg_conv.inner = (void*)(arg & (~1));
34562 arg_conv.is_owned = false;
34563 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34564 int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
34568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34569 LDKQueryShortChannelIds orig_conv;
34570 orig_conv.inner = (void*)(orig & (~1));
34571 orig_conv.is_owned = false;
34572 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34573 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
34574 int64_t ret_ref = 0;
34575 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34576 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34577 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34578 ret_ref = (uintptr_t)ret_var.inner;
34579 if (ret_var.is_owned) {
34585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34586 LDKReplyShortChannelIdsEnd this_obj_conv;
34587 this_obj_conv.inner = (void*)(this_obj & (~1));
34588 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34589 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34590 ReplyShortChannelIdsEnd_free(this_obj_conv);
34593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34594 LDKReplyShortChannelIdsEnd this_ptr_conv;
34595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34596 this_ptr_conv.is_owned = false;
34597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34598 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34599 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
34603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34604 LDKReplyShortChannelIdsEnd this_ptr_conv;
34605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34606 this_ptr_conv.is_owned = false;
34607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34608 LDKThirtyTwoBytes val_ref;
34609 CHECK((*env)->GetArrayLength(env, val) == 32);
34610 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34611 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
34614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
34615 LDKReplyShortChannelIdsEnd this_ptr_conv;
34616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34617 this_ptr_conv.is_owned = false;
34618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34619 jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
34623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34624 LDKReplyShortChannelIdsEnd this_ptr_conv;
34625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34626 this_ptr_conv.is_owned = false;
34627 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34628 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
34631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
34632 LDKThirtyTwoBytes chain_hash_arg_ref;
34633 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34634 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34635 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
34636 int64_t ret_ref = 0;
34637 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34638 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34640 ret_ref = (uintptr_t)ret_var.inner;
34641 if (ret_var.is_owned) {
34647 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
34648 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
34649 int64_t ret_ref = 0;
34650 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34651 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34652 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34653 ret_ref = (uintptr_t)ret_var.inner;
34654 if (ret_var.is_owned) {
34659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34660 LDKReplyShortChannelIdsEnd arg_conv;
34661 arg_conv.inner = (void*)(arg & (~1));
34662 arg_conv.is_owned = false;
34663 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34664 int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
34668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34669 LDKReplyShortChannelIdsEnd orig_conv;
34670 orig_conv.inner = (void*)(orig & (~1));
34671 orig_conv.is_owned = false;
34672 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34673 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
34674 int64_t ret_ref = 0;
34675 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34676 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34677 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34678 ret_ref = (uintptr_t)ret_var.inner;
34679 if (ret_var.is_owned) {
34685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34686 LDKGossipTimestampFilter this_obj_conv;
34687 this_obj_conv.inner = (void*)(this_obj & (~1));
34688 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34690 GossipTimestampFilter_free(this_obj_conv);
34693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34694 LDKGossipTimestampFilter this_ptr_conv;
34695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34696 this_ptr_conv.is_owned = false;
34697 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34698 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34699 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
34703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34704 LDKGossipTimestampFilter this_ptr_conv;
34705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34706 this_ptr_conv.is_owned = false;
34707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34708 LDKThirtyTwoBytes val_ref;
34709 CHECK((*env)->GetArrayLength(env, val) == 32);
34710 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34711 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
34714 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
34715 LDKGossipTimestampFilter this_ptr_conv;
34716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34717 this_ptr_conv.is_owned = false;
34718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34719 int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
34723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34724 LDKGossipTimestampFilter this_ptr_conv;
34725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34726 this_ptr_conv.is_owned = false;
34727 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34728 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
34731 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
34732 LDKGossipTimestampFilter this_ptr_conv;
34733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34734 this_ptr_conv.is_owned = false;
34735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34736 int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
34740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34741 LDKGossipTimestampFilter this_ptr_conv;
34742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34743 this_ptr_conv.is_owned = false;
34744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34745 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
34748 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) {
34749 LDKThirtyTwoBytes chain_hash_arg_ref;
34750 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34751 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34752 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
34753 int64_t ret_ref = 0;
34754 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34755 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34756 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34757 ret_ref = (uintptr_t)ret_var.inner;
34758 if (ret_var.is_owned) {
34764 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
34765 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
34766 int64_t ret_ref = 0;
34767 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34768 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34769 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34770 ret_ref = (uintptr_t)ret_var.inner;
34771 if (ret_var.is_owned) {
34776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34777 LDKGossipTimestampFilter arg_conv;
34778 arg_conv.inner = (void*)(arg & (~1));
34779 arg_conv.is_owned = false;
34780 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34781 int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
34785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34786 LDKGossipTimestampFilter orig_conv;
34787 orig_conv.inner = (void*)(orig & (~1));
34788 orig_conv.is_owned = false;
34789 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34790 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
34791 int64_t ret_ref = 0;
34792 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34793 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34794 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34795 ret_ref = (uintptr_t)ret_var.inner;
34796 if (ret_var.is_owned) {
34802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34803 if ((this_ptr & 1) != 0) return;
34804 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34805 CHECK_ACCESS(this_ptr_ptr);
34806 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
34807 FREE((void*)this_ptr);
34808 ErrorAction_free(this_ptr_conv);
34811 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
34812 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34813 *ret_copy = ErrorAction_clone(arg);
34814 int64_t ret_ref = (uintptr_t)ret_copy;
34817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34818 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
34819 int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
34823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34824 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
34825 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34826 *ret_copy = ErrorAction_clone(orig_conv);
34827 int64_t ret_ref = (uintptr_t)ret_copy;
34831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
34832 LDKErrorMessage msg_conv;
34833 msg_conv.inner = (void*)(msg & (~1));
34834 msg_conv.is_owned = (msg & 1) || (msg == 0);
34835 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34836 msg_conv = ErrorMessage_clone(&msg_conv);
34837 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34838 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
34839 int64_t ret_ref = (uintptr_t)ret_copy;
34843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
34844 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34845 *ret_copy = ErrorAction_ignore_error();
34846 int64_t ret_ref = (uintptr_t)ret_copy;
34850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
34851 LDKLevel a_conv = LDKLevel_from_java(env, a);
34852 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34853 *ret_copy = ErrorAction_ignore_and_log(a_conv);
34854 int64_t ret_ref = (uintptr_t)ret_copy;
34858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
34859 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34860 *ret_copy = ErrorAction_ignore_duplicate_gossip();
34861 int64_t ret_ref = (uintptr_t)ret_copy;
34865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
34866 LDKErrorMessage msg_conv;
34867 msg_conv.inner = (void*)(msg & (~1));
34868 msg_conv.is_owned = (msg & 1) || (msg == 0);
34869 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34870 msg_conv = ErrorMessage_clone(&msg_conv);
34871 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34872 *ret_copy = ErrorAction_send_error_message(msg_conv);
34873 int64_t ret_ref = (uintptr_t)ret_copy;
34877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
34878 LDKWarningMessage msg_conv;
34879 msg_conv.inner = (void*)(msg & (~1));
34880 msg_conv.is_owned = (msg & 1) || (msg == 0);
34881 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34882 msg_conv = WarningMessage_clone(&msg_conv);
34883 LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
34884 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34885 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
34886 int64_t ret_ref = (uintptr_t)ret_copy;
34890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34891 LDKLightningError this_obj_conv;
34892 this_obj_conv.inner = (void*)(this_obj & (~1));
34893 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34894 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34895 LightningError_free(this_obj_conv);
34898 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
34899 LDKLightningError this_ptr_conv;
34900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34901 this_ptr_conv.is_owned = false;
34902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34903 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
34904 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
34909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
34910 LDKLightningError this_ptr_conv;
34911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34912 this_ptr_conv.is_owned = false;
34913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34914 LDKStr val_conv = java_to_owned_str(env, val);
34915 LightningError_set_err(&this_ptr_conv, val_conv);
34918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
34919 LDKLightningError this_ptr_conv;
34920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34921 this_ptr_conv.is_owned = false;
34922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34923 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34924 *ret_copy = LightningError_get_action(&this_ptr_conv);
34925 int64_t ret_ref = (uintptr_t)ret_copy;
34929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34930 LDKLightningError this_ptr_conv;
34931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34932 this_ptr_conv.is_owned = false;
34933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34934 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
34935 CHECK_ACCESS(val_ptr);
34936 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
34937 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
34938 LightningError_set_action(&this_ptr_conv, val_conv);
34941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
34942 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
34943 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
34944 CHECK_ACCESS(action_arg_ptr);
34945 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
34946 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
34947 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
34948 int64_t ret_ref = 0;
34949 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34950 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34952 ret_ref = (uintptr_t)ret_var.inner;
34953 if (ret_var.is_owned) {
34959 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
34960 LDKLightningError ret_var = LightningError_clone(arg);
34961 int64_t ret_ref = 0;
34962 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34963 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
34966 if (ret_var.is_owned) {
34971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34972 LDKLightningError arg_conv;
34973 arg_conv.inner = (void*)(arg & (~1));
34974 arg_conv.is_owned = false;
34975 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34976 int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
34980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34981 LDKLightningError orig_conv;
34982 orig_conv.inner = (void*)(orig & (~1));
34983 orig_conv.is_owned = false;
34984 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34985 LDKLightningError ret_var = LightningError_clone(&orig_conv);
34986 int64_t ret_ref = 0;
34987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34990 ret_ref = (uintptr_t)ret_var.inner;
34991 if (ret_var.is_owned) {
34997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34998 LDKCommitmentUpdate this_obj_conv;
34999 this_obj_conv.inner = (void*)(this_obj & (~1));
35000 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35001 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35002 CommitmentUpdate_free(this_obj_conv);
35005 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35006 LDKCommitmentUpdate this_ptr_conv;
35007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35008 this_ptr_conv.is_owned = false;
35009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35010 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35011 int64_tArray ret_arr = NULL;
35012 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35013 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35014 for (size_t p = 0; p < ret_var.datalen; p++) {
35015 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35016 int64_t ret_conv_15_ref = 0;
35017 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35018 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35019 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35020 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
35021 if (ret_conv_15_var.is_owned) {
35022 ret_conv_15_ref |= 1;
35024 ret_arr_ptr[p] = ret_conv_15_ref;
35026 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35027 FREE(ret_var.data);
35031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35032 LDKCommitmentUpdate this_ptr_conv;
35033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35034 this_ptr_conv.is_owned = false;
35035 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35036 LDKCVec_UpdateAddHTLCZ val_constr;
35037 val_constr.datalen = (*env)->GetArrayLength(env, val);
35038 if (val_constr.datalen > 0)
35039 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35041 val_constr.data = NULL;
35042 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35043 for (size_t p = 0; p < val_constr.datalen; p++) {
35044 int64_t val_conv_15 = val_vals[p];
35045 LDKUpdateAddHTLC val_conv_15_conv;
35046 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
35047 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
35048 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
35049 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
35050 val_constr.data[p] = val_conv_15_conv;
35052 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35053 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
35056 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35057 LDKCommitmentUpdate this_ptr_conv;
35058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35059 this_ptr_conv.is_owned = false;
35060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35061 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
35062 int64_tArray ret_arr = NULL;
35063 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35064 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35065 for (size_t t = 0; t < ret_var.datalen; t++) {
35066 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
35067 int64_t ret_conv_19_ref = 0;
35068 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35069 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
35071 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
35072 if (ret_conv_19_var.is_owned) {
35073 ret_conv_19_ref |= 1;
35075 ret_arr_ptr[t] = ret_conv_19_ref;
35077 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35078 FREE(ret_var.data);
35082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35083 LDKCommitmentUpdate this_ptr_conv;
35084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35085 this_ptr_conv.is_owned = false;
35086 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35087 LDKCVec_UpdateFulfillHTLCZ val_constr;
35088 val_constr.datalen = (*env)->GetArrayLength(env, val);
35089 if (val_constr.datalen > 0)
35090 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35092 val_constr.data = NULL;
35093 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35094 for (size_t t = 0; t < val_constr.datalen; t++) {
35095 int64_t val_conv_19 = val_vals[t];
35096 LDKUpdateFulfillHTLC val_conv_19_conv;
35097 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
35098 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
35099 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
35100 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
35101 val_constr.data[t] = val_conv_19_conv;
35103 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35104 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
35107 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35108 LDKCommitmentUpdate this_ptr_conv;
35109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35110 this_ptr_conv.is_owned = false;
35111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35112 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
35113 int64_tArray ret_arr = NULL;
35114 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35115 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35116 for (size_t q = 0; q < ret_var.datalen; q++) {
35117 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
35118 int64_t ret_conv_16_ref = 0;
35119 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35120 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35122 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
35123 if (ret_conv_16_var.is_owned) {
35124 ret_conv_16_ref |= 1;
35126 ret_arr_ptr[q] = ret_conv_16_ref;
35128 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35129 FREE(ret_var.data);
35133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
35134 LDKCommitmentUpdate this_ptr_conv;
35135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35136 this_ptr_conv.is_owned = false;
35137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35138 LDKCVec_UpdateFailHTLCZ val_constr;
35139 val_constr.datalen = (*env)->GetArrayLength(env, val);
35140 if (val_constr.datalen > 0)
35141 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35143 val_constr.data = NULL;
35144 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35145 for (size_t q = 0; q < val_constr.datalen; q++) {
35146 int64_t val_conv_16 = val_vals[q];
35147 LDKUpdateFailHTLC val_conv_16_conv;
35148 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
35149 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
35150 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
35151 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
35152 val_constr.data[q] = val_conv_16_conv;
35154 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35155 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
35158 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
35159 LDKCommitmentUpdate this_ptr_conv;
35160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35161 this_ptr_conv.is_owned = false;
35162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35163 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
35164 int64_tArray ret_arr = NULL;
35165 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
35166 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
35167 for (size_t z = 0; z < ret_var.datalen; z++) {
35168 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
35169 int64_t ret_conv_25_ref = 0;
35170 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35171 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
35173 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
35174 if (ret_conv_25_var.is_owned) {
35175 ret_conv_25_ref |= 1;
35177 ret_arr_ptr[z] = ret_conv_25_ref;
35179 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
35180 FREE(ret_var.data);
35184 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) {
35185 LDKCommitmentUpdate this_ptr_conv;
35186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35187 this_ptr_conv.is_owned = false;
35188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35189 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
35190 val_constr.datalen = (*env)->GetArrayLength(env, val);
35191 if (val_constr.datalen > 0)
35192 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35194 val_constr.data = NULL;
35195 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
35196 for (size_t z = 0; z < val_constr.datalen; z++) {
35197 int64_t val_conv_25 = val_vals[z];
35198 LDKUpdateFailMalformedHTLC val_conv_25_conv;
35199 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
35200 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
35201 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
35202 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
35203 val_constr.data[z] = val_conv_25_conv;
35205 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
35206 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
35209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
35210 LDKCommitmentUpdate this_ptr_conv;
35211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35212 this_ptr_conv.is_owned = false;
35213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35214 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
35215 int64_t ret_ref = 0;
35216 if ((uintptr_t)ret_var.inner > 4096) {
35217 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35218 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35219 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35220 ret_ref = (uintptr_t)ret_var.inner;
35221 if (ret_var.is_owned) {
35228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35229 LDKCommitmentUpdate this_ptr_conv;
35230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35231 this_ptr_conv.is_owned = false;
35232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35233 LDKUpdateFee val_conv;
35234 val_conv.inner = (void*)(val & (~1));
35235 val_conv.is_owned = (val & 1) || (val == 0);
35236 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35237 val_conv = UpdateFee_clone(&val_conv);
35238 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
35241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
35242 LDKCommitmentUpdate this_ptr_conv;
35243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35244 this_ptr_conv.is_owned = false;
35245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35246 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
35247 int64_t ret_ref = 0;
35248 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35249 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35250 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35251 ret_ref = (uintptr_t)ret_var.inner;
35252 if (ret_var.is_owned) {
35258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35259 LDKCommitmentUpdate this_ptr_conv;
35260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35261 this_ptr_conv.is_owned = false;
35262 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35263 LDKCommitmentSigned val_conv;
35264 val_conv.inner = (void*)(val & (~1));
35265 val_conv.is_owned = (val & 1) || (val == 0);
35266 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35267 val_conv = CommitmentSigned_clone(&val_conv);
35268 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
35271 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) {
35272 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
35273 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
35274 if (update_add_htlcs_arg_constr.datalen > 0)
35275 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35277 update_add_htlcs_arg_constr.data = NULL;
35278 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
35279 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
35280 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
35281 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
35282 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
35283 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
35284 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
35285 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
35286 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
35288 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
35289 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
35290 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
35291 if (update_fulfill_htlcs_arg_constr.datalen > 0)
35292 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35294 update_fulfill_htlcs_arg_constr.data = NULL;
35295 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
35296 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
35297 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
35298 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
35299 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
35300 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
35301 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
35302 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
35303 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
35305 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
35306 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
35307 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
35308 if (update_fail_htlcs_arg_constr.datalen > 0)
35309 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35311 update_fail_htlcs_arg_constr.data = NULL;
35312 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
35313 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
35314 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
35315 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
35316 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
35317 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
35318 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
35319 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
35320 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
35322 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
35323 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
35324 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
35325 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
35326 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35328 update_fail_malformed_htlcs_arg_constr.data = NULL;
35329 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
35330 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
35331 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
35332 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
35333 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
35334 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);
35335 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
35336 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
35337 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
35339 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
35340 LDKUpdateFee update_fee_arg_conv;
35341 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
35342 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
35343 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
35344 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
35345 LDKCommitmentSigned commitment_signed_arg_conv;
35346 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
35347 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
35348 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
35349 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
35350 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);
35351 int64_t ret_ref = 0;
35352 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35353 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35355 ret_ref = (uintptr_t)ret_var.inner;
35356 if (ret_var.is_owned) {
35362 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
35363 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
35364 int64_t ret_ref = 0;
35365 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35366 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35367 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35368 ret_ref = (uintptr_t)ret_var.inner;
35369 if (ret_var.is_owned) {
35374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35375 LDKCommitmentUpdate arg_conv;
35376 arg_conv.inner = (void*)(arg & (~1));
35377 arg_conv.is_owned = false;
35378 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35379 int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
35383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35384 LDKCommitmentUpdate orig_conv;
35385 orig_conv.inner = (void*)(orig & (~1));
35386 orig_conv.is_owned = false;
35387 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35388 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
35389 int64_t ret_ref = 0;
35390 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35391 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35392 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35393 ret_ref = (uintptr_t)ret_var.inner;
35394 if (ret_var.is_owned) {
35400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35401 if ((this_ptr & 1) != 0) return;
35402 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35403 CHECK_ACCESS(this_ptr_ptr);
35404 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
35405 FREE((void*)this_ptr);
35406 ChannelMessageHandler_free(this_ptr_conv);
35409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35410 if ((this_ptr & 1) != 0) return;
35411 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35412 CHECK_ACCESS(this_ptr_ptr);
35413 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
35414 FREE((void*)this_ptr);
35415 RoutingMessageHandler_free(this_ptr_conv);
35418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
35419 LDKAcceptChannel obj_conv;
35420 obj_conv.inner = (void*)(obj & (~1));
35421 obj_conv.is_owned = false;
35422 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35423 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
35424 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35425 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35426 CVec_u8Z_free(ret_var);
35430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35431 LDKu8slice ser_ref;
35432 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35433 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35434 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
35435 *ret_conv = AcceptChannel_read(ser_ref);
35436 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35437 return (int64_t)ret_conv;
35440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
35441 LDKAnnouncementSignatures obj_conv;
35442 obj_conv.inner = (void*)(obj & (~1));
35443 obj_conv.is_owned = false;
35444 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35445 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
35446 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35447 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35448 CVec_u8Z_free(ret_var);
35452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35453 LDKu8slice ser_ref;
35454 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35455 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35456 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
35457 *ret_conv = AnnouncementSignatures_read(ser_ref);
35458 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35459 return (int64_t)ret_conv;
35462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
35463 LDKChannelReestablish obj_conv;
35464 obj_conv.inner = (void*)(obj & (~1));
35465 obj_conv.is_owned = false;
35466 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35467 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
35468 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35469 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35470 CVec_u8Z_free(ret_var);
35474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35475 LDKu8slice ser_ref;
35476 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35477 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35478 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
35479 *ret_conv = ChannelReestablish_read(ser_ref);
35480 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35481 return (int64_t)ret_conv;
35484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
35485 LDKClosingSigned obj_conv;
35486 obj_conv.inner = (void*)(obj & (~1));
35487 obj_conv.is_owned = false;
35488 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35489 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
35490 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35491 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35492 CVec_u8Z_free(ret_var);
35496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35497 LDKu8slice ser_ref;
35498 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35499 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35500 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
35501 *ret_conv = ClosingSigned_read(ser_ref);
35502 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35503 return (int64_t)ret_conv;
35506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
35507 LDKClosingSignedFeeRange obj_conv;
35508 obj_conv.inner = (void*)(obj & (~1));
35509 obj_conv.is_owned = false;
35510 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35511 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
35512 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35513 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35514 CVec_u8Z_free(ret_var);
35518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35519 LDKu8slice ser_ref;
35520 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35521 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35522 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
35523 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
35524 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35525 return (int64_t)ret_conv;
35528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
35529 LDKCommitmentSigned obj_conv;
35530 obj_conv.inner = (void*)(obj & (~1));
35531 obj_conv.is_owned = false;
35532 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35533 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
35534 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35535 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35536 CVec_u8Z_free(ret_var);
35540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35541 LDKu8slice ser_ref;
35542 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35543 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35544 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
35545 *ret_conv = CommitmentSigned_read(ser_ref);
35546 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35547 return (int64_t)ret_conv;
35550 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
35551 LDKFundingCreated obj_conv;
35552 obj_conv.inner = (void*)(obj & (~1));
35553 obj_conv.is_owned = false;
35554 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35555 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
35556 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35557 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35558 CVec_u8Z_free(ret_var);
35562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35563 LDKu8slice ser_ref;
35564 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35565 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35566 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
35567 *ret_conv = FundingCreated_read(ser_ref);
35568 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35569 return (int64_t)ret_conv;
35572 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
35573 LDKFundingSigned obj_conv;
35574 obj_conv.inner = (void*)(obj & (~1));
35575 obj_conv.is_owned = false;
35576 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35577 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
35578 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35579 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35580 CVec_u8Z_free(ret_var);
35584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35585 LDKu8slice ser_ref;
35586 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35587 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35588 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
35589 *ret_conv = FundingSigned_read(ser_ref);
35590 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35591 return (int64_t)ret_conv;
35594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
35595 LDKFundingLocked obj_conv;
35596 obj_conv.inner = (void*)(obj & (~1));
35597 obj_conv.is_owned = false;
35598 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35599 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
35600 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35601 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35602 CVec_u8Z_free(ret_var);
35606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35607 LDKu8slice ser_ref;
35608 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35609 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35610 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
35611 *ret_conv = FundingLocked_read(ser_ref);
35612 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35613 return (int64_t)ret_conv;
35616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
35618 obj_conv.inner = (void*)(obj & (~1));
35619 obj_conv.is_owned = false;
35620 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35621 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
35622 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35623 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35624 CVec_u8Z_free(ret_var);
35628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35629 LDKu8slice ser_ref;
35630 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35631 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35632 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
35633 *ret_conv = Init_read(ser_ref);
35634 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35635 return (int64_t)ret_conv;
35638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
35639 LDKOpenChannel obj_conv;
35640 obj_conv.inner = (void*)(obj & (~1));
35641 obj_conv.is_owned = false;
35642 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35643 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
35644 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35645 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35646 CVec_u8Z_free(ret_var);
35650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35651 LDKu8slice ser_ref;
35652 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35653 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35654 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
35655 *ret_conv = OpenChannel_read(ser_ref);
35656 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35657 return (int64_t)ret_conv;
35660 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
35661 LDKRevokeAndACK obj_conv;
35662 obj_conv.inner = (void*)(obj & (~1));
35663 obj_conv.is_owned = false;
35664 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35665 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
35666 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35667 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35668 CVec_u8Z_free(ret_var);
35672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35673 LDKu8slice ser_ref;
35674 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35675 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35676 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
35677 *ret_conv = RevokeAndACK_read(ser_ref);
35678 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35679 return (int64_t)ret_conv;
35682 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
35683 LDKShutdown obj_conv;
35684 obj_conv.inner = (void*)(obj & (~1));
35685 obj_conv.is_owned = false;
35686 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35687 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
35688 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35689 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35690 CVec_u8Z_free(ret_var);
35694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35695 LDKu8slice ser_ref;
35696 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35697 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35698 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35699 *ret_conv = Shutdown_read(ser_ref);
35700 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35701 return (int64_t)ret_conv;
35704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35705 LDKUpdateFailHTLC obj_conv;
35706 obj_conv.inner = (void*)(obj & (~1));
35707 obj_conv.is_owned = false;
35708 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35709 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
35710 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35711 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35712 CVec_u8Z_free(ret_var);
35716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35717 LDKu8slice ser_ref;
35718 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35719 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35720 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35721 *ret_conv = UpdateFailHTLC_read(ser_ref);
35722 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35723 return (int64_t)ret_conv;
35726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35727 LDKUpdateFailMalformedHTLC obj_conv;
35728 obj_conv.inner = (void*)(obj & (~1));
35729 obj_conv.is_owned = false;
35730 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35731 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
35732 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35733 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35734 CVec_u8Z_free(ret_var);
35738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35739 LDKu8slice ser_ref;
35740 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35741 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35742 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35743 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
35744 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35745 return (int64_t)ret_conv;
35748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
35749 LDKUpdateFee obj_conv;
35750 obj_conv.inner = (void*)(obj & (~1));
35751 obj_conv.is_owned = false;
35752 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35753 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
35754 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35755 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35756 CVec_u8Z_free(ret_var);
35760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35761 LDKu8slice ser_ref;
35762 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35763 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35764 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35765 *ret_conv = UpdateFee_read(ser_ref);
35766 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35767 return (int64_t)ret_conv;
35770 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35771 LDKUpdateFulfillHTLC obj_conv;
35772 obj_conv.inner = (void*)(obj & (~1));
35773 obj_conv.is_owned = false;
35774 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35775 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
35776 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35777 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35778 CVec_u8Z_free(ret_var);
35782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35783 LDKu8slice ser_ref;
35784 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35785 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35786 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35787 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
35788 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35789 return (int64_t)ret_conv;
35792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35793 LDKUpdateAddHTLC obj_conv;
35794 obj_conv.inner = (void*)(obj & (~1));
35795 obj_conv.is_owned = false;
35796 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35797 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
35798 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35799 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35800 CVec_u8Z_free(ret_var);
35804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35805 LDKu8slice ser_ref;
35806 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35807 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35808 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35809 *ret_conv = UpdateAddHTLC_read(ser_ref);
35810 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35811 return (int64_t)ret_conv;
35814 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
35816 obj_conv.inner = (void*)(obj & (~1));
35817 obj_conv.is_owned = false;
35818 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35819 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
35820 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35821 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35822 CVec_u8Z_free(ret_var);
35826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35827 LDKu8slice ser_ref;
35828 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35829 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35830 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35831 *ret_conv = Ping_read(ser_ref);
35832 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35833 return (int64_t)ret_conv;
35836 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
35838 obj_conv.inner = (void*)(obj & (~1));
35839 obj_conv.is_owned = false;
35840 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35841 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
35842 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35843 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35844 CVec_u8Z_free(ret_var);
35848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35849 LDKu8slice ser_ref;
35850 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35851 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35852 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35853 *ret_conv = Pong_read(ser_ref);
35854 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35855 return (int64_t)ret_conv;
35858 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35859 LDKUnsignedChannelAnnouncement obj_conv;
35860 obj_conv.inner = (void*)(obj & (~1));
35861 obj_conv.is_owned = false;
35862 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35863 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
35864 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35865 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35866 CVec_u8Z_free(ret_var);
35870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35871 LDKu8slice ser_ref;
35872 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35873 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35874 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35875 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
35876 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35877 return (int64_t)ret_conv;
35880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35881 LDKChannelAnnouncement obj_conv;
35882 obj_conv.inner = (void*)(obj & (~1));
35883 obj_conv.is_owned = false;
35884 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35885 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
35886 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35887 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35888 CVec_u8Z_free(ret_var);
35892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35893 LDKu8slice ser_ref;
35894 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35895 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35896 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35897 *ret_conv = ChannelAnnouncement_read(ser_ref);
35898 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35899 return (int64_t)ret_conv;
35902 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35903 LDKUnsignedChannelUpdate obj_conv;
35904 obj_conv.inner = (void*)(obj & (~1));
35905 obj_conv.is_owned = false;
35906 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35907 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
35908 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35909 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35910 CVec_u8Z_free(ret_var);
35914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35915 LDKu8slice ser_ref;
35916 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35917 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35918 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35919 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
35920 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35921 return (int64_t)ret_conv;
35924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35925 LDKChannelUpdate obj_conv;
35926 obj_conv.inner = (void*)(obj & (~1));
35927 obj_conv.is_owned = false;
35928 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35929 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
35930 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35931 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35932 CVec_u8Z_free(ret_var);
35936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35937 LDKu8slice ser_ref;
35938 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35939 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35940 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35941 *ret_conv = ChannelUpdate_read(ser_ref);
35942 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35943 return (int64_t)ret_conv;
35946 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
35947 LDKErrorMessage obj_conv;
35948 obj_conv.inner = (void*)(obj & (~1));
35949 obj_conv.is_owned = false;
35950 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35951 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
35952 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35953 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35954 CVec_u8Z_free(ret_var);
35958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35959 LDKu8slice ser_ref;
35960 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35961 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35962 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35963 *ret_conv = ErrorMessage_read(ser_ref);
35964 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35965 return (int64_t)ret_conv;
35968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
35969 LDKWarningMessage obj_conv;
35970 obj_conv.inner = (void*)(obj & (~1));
35971 obj_conv.is_owned = false;
35972 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35973 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
35974 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35975 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35976 CVec_u8Z_free(ret_var);
35980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35981 LDKu8slice ser_ref;
35982 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35983 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35984 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35985 *ret_conv = WarningMessage_read(ser_ref);
35986 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35987 return (int64_t)ret_conv;
35990 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35991 LDKUnsignedNodeAnnouncement obj_conv;
35992 obj_conv.inner = (void*)(obj & (~1));
35993 obj_conv.is_owned = false;
35994 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35995 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
35996 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35997 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35998 CVec_u8Z_free(ret_var);
36002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36003 LDKu8slice ser_ref;
36004 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36005 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36006 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
36007 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
36008 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36009 return (int64_t)ret_conv;
36012 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
36013 LDKNodeAnnouncement obj_conv;
36014 obj_conv.inner = (void*)(obj & (~1));
36015 obj_conv.is_owned = false;
36016 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36017 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
36018 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36019 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36020 CVec_u8Z_free(ret_var);
36024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36025 LDKu8slice ser_ref;
36026 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36027 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36028 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36029 *ret_conv = NodeAnnouncement_read(ser_ref);
36030 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36031 return (int64_t)ret_conv;
36034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36035 LDKu8slice ser_ref;
36036 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36037 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36038 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36039 *ret_conv = QueryShortChannelIds_read(ser_ref);
36040 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36041 return (int64_t)ret_conv;
36044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
36045 LDKQueryShortChannelIds obj_conv;
36046 obj_conv.inner = (void*)(obj & (~1));
36047 obj_conv.is_owned = false;
36048 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36049 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
36050 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36051 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36052 CVec_u8Z_free(ret_var);
36056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
36057 LDKReplyShortChannelIdsEnd obj_conv;
36058 obj_conv.inner = (void*)(obj & (~1));
36059 obj_conv.is_owned = false;
36060 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36061 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
36062 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36063 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36064 CVec_u8Z_free(ret_var);
36068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36069 LDKu8slice ser_ref;
36070 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36071 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36072 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36073 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
36074 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36075 return (int64_t)ret_conv;
36078 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
36079 LDKQueryChannelRange this_arg_conv;
36080 this_arg_conv.inner = (void*)(this_arg & (~1));
36081 this_arg_conv.is_owned = false;
36082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36083 int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
36087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36088 LDKQueryChannelRange obj_conv;
36089 obj_conv.inner = (void*)(obj & (~1));
36090 obj_conv.is_owned = false;
36091 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36092 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
36093 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36094 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36095 CVec_u8Z_free(ret_var);
36099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36100 LDKu8slice ser_ref;
36101 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36102 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36103 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36104 *ret_conv = QueryChannelRange_read(ser_ref);
36105 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36106 return (int64_t)ret_conv;
36109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36110 LDKu8slice ser_ref;
36111 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36112 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36113 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36114 *ret_conv = ReplyChannelRange_read(ser_ref);
36115 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36116 return (int64_t)ret_conv;
36119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
36120 LDKReplyChannelRange obj_conv;
36121 obj_conv.inner = (void*)(obj & (~1));
36122 obj_conv.is_owned = false;
36123 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36124 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
36125 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36126 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36127 CVec_u8Z_free(ret_var);
36131 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
36132 LDKGossipTimestampFilter obj_conv;
36133 obj_conv.inner = (void*)(obj & (~1));
36134 obj_conv.is_owned = false;
36135 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36136 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
36137 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36138 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36139 CVec_u8Z_free(ret_var);
36143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36144 LDKu8slice ser_ref;
36145 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36146 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36147 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36148 *ret_conv = GossipTimestampFilter_read(ser_ref);
36149 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36150 return (int64_t)ret_conv;
36153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36154 if ((this_ptr & 1) != 0) return;
36155 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36156 CHECK_ACCESS(this_ptr_ptr);
36157 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
36158 FREE((void*)this_ptr);
36159 CustomMessageHandler_free(this_ptr_conv);
36162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36163 LDKIgnoringMessageHandler this_obj_conv;
36164 this_obj_conv.inner = (void*)(this_obj & (~1));
36165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36167 IgnoringMessageHandler_free(this_obj_conv);
36170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
36171 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
36172 int64_t ret_ref = 0;
36173 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36174 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36175 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36176 ret_ref = (uintptr_t)ret_var.inner;
36177 if (ret_var.is_owned) {
36183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
36184 LDKIgnoringMessageHandler this_arg_conv;
36185 this_arg_conv.inner = (void*)(this_arg & (~1));
36186 this_arg_conv.is_owned = false;
36187 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36188 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36189 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36190 return (int64_t)ret_ret;
36193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36194 LDKIgnoringMessageHandler this_arg_conv;
36195 this_arg_conv.inner = (void*)(this_arg & (~1));
36196 this_arg_conv.is_owned = false;
36197 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36198 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
36199 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
36200 return (int64_t)ret_ret;
36203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
36204 LDKIgnoringMessageHandler this_arg_conv;
36205 this_arg_conv.inner = (void*)(this_arg & (~1));
36206 this_arg_conv.is_owned = false;
36207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36208 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
36209 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
36210 return (int64_t)ret_ret;
36213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36214 LDKIgnoringMessageHandler this_arg_conv;
36215 this_arg_conv.inner = (void*)(this_arg & (~1));
36216 this_arg_conv.is_owned = false;
36217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36218 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
36219 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
36220 return (int64_t)ret_ret;
36223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36224 LDKErroringMessageHandler this_obj_conv;
36225 this_obj_conv.inner = (void*)(this_obj & (~1));
36226 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36228 ErroringMessageHandler_free(this_obj_conv);
36231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
36232 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
36233 int64_t ret_ref = 0;
36234 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36235 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36236 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36237 ret_ref = (uintptr_t)ret_var.inner;
36238 if (ret_var.is_owned) {
36244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
36245 LDKErroringMessageHandler this_arg_conv;
36246 this_arg_conv.inner = (void*)(this_arg & (~1));
36247 this_arg_conv.is_owned = false;
36248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36249 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36250 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36251 return (int64_t)ret_ret;
36254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
36255 LDKErroringMessageHandler this_arg_conv;
36256 this_arg_conv.inner = (void*)(this_arg & (~1));
36257 this_arg_conv.is_owned = false;
36258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36259 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
36260 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
36261 return (int64_t)ret_ret;
36264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36265 LDKMessageHandler this_obj_conv;
36266 this_obj_conv.inner = (void*)(this_obj & (~1));
36267 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36268 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36269 MessageHandler_free(this_obj_conv);
36272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
36273 LDKMessageHandler this_ptr_conv;
36274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36275 this_ptr_conv.is_owned = false;
36276 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36277 // WARNING: This object doesn't live past this scope, needs clone!
36278 int64_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
36282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36283 LDKMessageHandler this_ptr_conv;
36284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36285 this_ptr_conv.is_owned = false;
36286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36287 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
36288 CHECK_ACCESS(val_ptr);
36289 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
36290 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
36291 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36292 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
36294 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
36297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
36298 LDKMessageHandler 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 // WARNING: This object doesn't live past this scope, needs clone!
36303 int64_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
36307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36308 LDKMessageHandler this_ptr_conv;
36309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36310 this_ptr_conv.is_owned = false;
36311 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36312 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
36313 CHECK_ACCESS(val_ptr);
36314 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
36315 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36316 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36317 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
36319 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
36322 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) {
36323 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
36324 CHECK_ACCESS(chan_handler_arg_ptr);
36325 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
36326 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
36327 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36328 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
36330 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
36331 CHECK_ACCESS(route_handler_arg_ptr);
36332 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
36333 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36334 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36335 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
36337 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
36338 int64_t ret_ref = 0;
36339 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36340 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36342 ret_ref = (uintptr_t)ret_var.inner;
36343 if (ret_var.is_owned) {
36349 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
36350 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
36351 *ret_ret = SocketDescriptor_clone(arg);
36352 return (int64_t)ret_ret;
36354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36355 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
36356 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
36357 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
36358 int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
36362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36363 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
36364 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
36365 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
36366 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
36367 *ret_ret = SocketDescriptor_clone(orig_conv);
36368 return (int64_t)ret_ret;
36371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
36372 if ((this_ptr & 1) != 0) return;
36373 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
36374 CHECK_ACCESS(this_ptr_ptr);
36375 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
36376 FREE((void*)this_ptr);
36377 SocketDescriptor_free(this_ptr_conv);
36380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36381 LDKPeerHandleError this_obj_conv;
36382 this_obj_conv.inner = (void*)(this_obj & (~1));
36383 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36385 PeerHandleError_free(this_obj_conv);
36388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
36389 LDKPeerHandleError this_ptr_conv;
36390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36391 this_ptr_conv.is_owned = false;
36392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36393 jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
36397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36398 LDKPeerHandleError this_ptr_conv;
36399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36400 this_ptr_conv.is_owned = false;
36401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36402 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
36405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
36406 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
36407 int64_t ret_ref = 0;
36408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36411 ret_ref = (uintptr_t)ret_var.inner;
36412 if (ret_var.is_owned) {
36418 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
36419 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
36420 int64_t ret_ref = 0;
36421 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36422 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36423 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36424 ret_ref = (uintptr_t)ret_var.inner;
36425 if (ret_var.is_owned) {
36430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36431 LDKPeerHandleError arg_conv;
36432 arg_conv.inner = (void*)(arg & (~1));
36433 arg_conv.is_owned = false;
36434 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36435 int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
36439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36440 LDKPeerHandleError orig_conv;
36441 orig_conv.inner = (void*)(orig & (~1));
36442 orig_conv.is_owned = false;
36443 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36444 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
36445 int64_t ret_ref = 0;
36446 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36447 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36448 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36449 ret_ref = (uintptr_t)ret_var.inner;
36450 if (ret_var.is_owned) {
36456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36457 LDKPeerManager this_obj_conv;
36458 this_obj_conv.inner = (void*)(this_obj & (~1));
36459 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36461 PeerManager_free(this_obj_conv);
36464 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) {
36465 LDKMessageHandler message_handler_conv;
36466 message_handler_conv.inner = (void*)(message_handler & (~1));
36467 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
36468 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
36469 // WARNING: we need a move here but no clone is available for LDKMessageHandler
36470 LDKSecretKey our_node_secret_ref;
36471 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
36472 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
36473 unsigned char ephemeral_random_data_arr[32];
36474 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
36475 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
36476 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
36477 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
36478 CHECK_ACCESS(logger_ptr);
36479 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36480 if (logger_conv.free == LDKLogger_JCalls_free) {
36481 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36482 LDKLogger_JCalls_cloned(&logger_conv);
36484 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
36485 CHECK_ACCESS(custom_message_handler_ptr);
36486 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
36487 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
36488 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36489 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
36491 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
36492 int64_t ret_ref = 0;
36493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36496 ret_ref = (uintptr_t)ret_var.inner;
36497 if (ret_var.is_owned) {
36503 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
36504 LDKPeerManager this_arg_conv;
36505 this_arg_conv.inner = (void*)(this_arg & (~1));
36506 this_arg_conv.is_owned = false;
36507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36508 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
36509 jobjectArray ret_arr = NULL;
36510 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
36512 for (size_t i = 0; i < ret_var.datalen; i++) {
36513 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
36514 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
36515 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
36518 FREE(ret_var.data);
36522 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, int64_t remote_network_address) {
36523 LDKPeerManager this_arg_conv;
36524 this_arg_conv.inner = (void*)(this_arg & (~1));
36525 this_arg_conv.is_owned = false;
36526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36527 LDKPublicKey their_node_id_ref;
36528 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
36529 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
36530 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
36531 CHECK_ACCESS(descriptor_ptr);
36532 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
36533 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
36534 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36535 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
36537 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
36538 CHECK_ACCESS(remote_network_address_ptr);
36539 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
36540 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
36541 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
36542 return (int64_t)ret_conv;
36545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor, int64_t remote_network_address) {
36546 LDKPeerManager this_arg_conv;
36547 this_arg_conv.inner = (void*)(this_arg & (~1));
36548 this_arg_conv.is_owned = false;
36549 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36550 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
36551 CHECK_ACCESS(descriptor_ptr);
36552 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
36553 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
36554 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36555 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
36557 void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1);
36558 CHECK_ACCESS(remote_network_address_ptr);
36559 LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
36560 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
36561 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
36562 return (int64_t)ret_conv;
36565 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) {
36566 LDKPeerManager this_arg_conv;
36567 this_arg_conv.inner = (void*)(this_arg & (~1));
36568 this_arg_conv.is_owned = false;
36569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36570 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
36571 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
36572 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
36573 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
36574 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
36575 return (int64_t)ret_conv;
36578 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) {
36579 LDKPeerManager this_arg_conv;
36580 this_arg_conv.inner = (void*)(this_arg & (~1));
36581 this_arg_conv.is_owned = false;
36582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36583 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
36584 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
36585 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
36586 LDKu8slice data_ref;
36587 data_ref.datalen = (*env)->GetArrayLength(env, data);
36588 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
36589 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
36590 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
36591 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
36592 return (int64_t)ret_conv;
36595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
36596 LDKPeerManager this_arg_conv;
36597 this_arg_conv.inner = (void*)(this_arg & (~1));
36598 this_arg_conv.is_owned = false;
36599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36600 PeerManager_process_events(&this_arg_conv);
36603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
36604 LDKPeerManager this_arg_conv;
36605 this_arg_conv.inner = (void*)(this_arg & (~1));
36606 this_arg_conv.is_owned = false;
36607 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36608 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
36609 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
36610 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
36611 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
36614 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) {
36615 LDKPeerManager this_arg_conv;
36616 this_arg_conv.inner = (void*)(this_arg & (~1));
36617 this_arg_conv.is_owned = false;
36618 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36619 LDKPublicKey node_id_ref;
36620 CHECK((*env)->GetArrayLength(env, node_id) == 33);
36621 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
36622 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
36625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
36626 LDKPeerManager this_arg_conv;
36627 this_arg_conv.inner = (void*)(this_arg & (~1));
36628 this_arg_conv.is_owned = false;
36629 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36630 PeerManager_disconnect_all_peers(&this_arg_conv);
36633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
36634 LDKPeerManager this_arg_conv;
36635 this_arg_conv.inner = (void*)(this_arg & (~1));
36636 this_arg_conv.is_owned = false;
36637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36638 PeerManager_timer_tick_occurred(&this_arg_conv);
36641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
36642 int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
36646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
36647 int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
36651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
36652 unsigned char commitment_seed_arr[32];
36653 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
36654 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
36655 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
36656 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36657 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
36661 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) {
36662 LDKCVec_u8Z to_holder_script_ref;
36663 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
36664 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
36665 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
36666 LDKCVec_u8Z to_counterparty_script_ref;
36667 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
36668 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
36669 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
36670 LDKOutPoint funding_outpoint_conv;
36671 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
36672 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
36673 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36674 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36675 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);
36676 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36677 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36678 Transaction_free(ret_var);
36682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36683 LDKCounterpartyCommitmentSecrets this_obj_conv;
36684 this_obj_conv.inner = (void*)(this_obj & (~1));
36685 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36687 CounterpartyCommitmentSecrets_free(this_obj_conv);
36690 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
36691 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
36692 int64_t ret_ref = 0;
36693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36696 ret_ref = (uintptr_t)ret_var.inner;
36697 if (ret_var.is_owned) {
36702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36703 LDKCounterpartyCommitmentSecrets arg_conv;
36704 arg_conv.inner = (void*)(arg & (~1));
36705 arg_conv.is_owned = false;
36706 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36707 int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
36711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36712 LDKCounterpartyCommitmentSecrets orig_conv;
36713 orig_conv.inner = (void*)(orig & (~1));
36714 orig_conv.is_owned = false;
36715 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36716 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
36717 int64_t ret_ref = 0;
36718 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36719 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36720 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36721 ret_ref = (uintptr_t)ret_var.inner;
36722 if (ret_var.is_owned) {
36728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
36729 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
36730 int64_t ret_ref = 0;
36731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36734 ret_ref = (uintptr_t)ret_var.inner;
36735 if (ret_var.is_owned) {
36741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
36742 LDKCounterpartyCommitmentSecrets this_arg_conv;
36743 this_arg_conv.inner = (void*)(this_arg & (~1));
36744 this_arg_conv.is_owned = false;
36745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36746 int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
36750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1provide_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
36751 LDKCounterpartyCommitmentSecrets this_arg_conv;
36752 this_arg_conv.inner = (void*)(this_arg & (~1));
36753 this_arg_conv.is_owned = false;
36754 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36755 LDKThirtyTwoBytes secret_ref;
36756 CHECK((*env)->GetArrayLength(env, secret) == 32);
36757 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
36758 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36759 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
36760 return (int64_t)ret_conv;
36763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
36764 LDKCounterpartyCommitmentSecrets this_arg_conv;
36765 this_arg_conv.inner = (void*)(this_arg & (~1));
36766 this_arg_conv.is_owned = false;
36767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36768 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36769 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
36773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
36774 LDKCounterpartyCommitmentSecrets obj_conv;
36775 obj_conv.inner = (void*)(obj & (~1));
36776 obj_conv.is_owned = false;
36777 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36778 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
36779 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36780 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36781 CVec_u8Z_free(ret_var);
36785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36786 LDKu8slice ser_ref;
36787 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36788 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36789 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36790 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
36791 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36792 return (int64_t)ret_conv;
36795 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) {
36796 LDKPublicKey per_commitment_point_ref;
36797 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36798 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36799 unsigned char base_secret_arr[32];
36800 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
36801 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
36802 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
36803 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36804 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
36805 return (int64_t)ret_conv;
36808 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) {
36809 LDKPublicKey per_commitment_point_ref;
36810 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36811 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36812 LDKPublicKey base_point_ref;
36813 CHECK((*env)->GetArrayLength(env, base_point) == 33);
36814 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
36815 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36816 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
36817 return (int64_t)ret_conv;
36820 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) {
36821 unsigned char per_commitment_secret_arr[32];
36822 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
36823 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
36824 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
36825 unsigned char countersignatory_revocation_base_secret_arr[32];
36826 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
36827 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
36828 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
36829 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36830 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
36831 return (int64_t)ret_conv;
36834 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) {
36835 LDKPublicKey per_commitment_point_ref;
36836 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36837 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36838 LDKPublicKey countersignatory_revocation_base_point_ref;
36839 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
36840 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
36841 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36842 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
36843 return (int64_t)ret_conv;
36846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36847 LDKTxCreationKeys this_obj_conv;
36848 this_obj_conv.inner = (void*)(this_obj & (~1));
36849 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36851 TxCreationKeys_free(this_obj_conv);
36854 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
36855 LDKTxCreationKeys this_ptr_conv;
36856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36857 this_ptr_conv.is_owned = false;
36858 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36859 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36860 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
36864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36865 LDKTxCreationKeys this_ptr_conv;
36866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36867 this_ptr_conv.is_owned = false;
36868 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36869 LDKPublicKey val_ref;
36870 CHECK((*env)->GetArrayLength(env, val) == 33);
36871 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36872 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
36875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36876 LDKTxCreationKeys this_ptr_conv;
36877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36878 this_ptr_conv.is_owned = false;
36879 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36880 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36881 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
36885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36886 LDKTxCreationKeys this_ptr_conv;
36887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36888 this_ptr_conv.is_owned = false;
36889 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36890 LDKPublicKey val_ref;
36891 CHECK((*env)->GetArrayLength(env, val) == 33);
36892 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36893 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
36896 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36897 LDKTxCreationKeys this_ptr_conv;
36898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36899 this_ptr_conv.is_owned = false;
36900 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36901 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36902 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
36906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36907 LDKTxCreationKeys this_ptr_conv;
36908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36909 this_ptr_conv.is_owned = false;
36910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36911 LDKPublicKey val_ref;
36912 CHECK((*env)->GetArrayLength(env, val) == 33);
36913 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36914 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
36917 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36918 LDKTxCreationKeys this_ptr_conv;
36919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36920 this_ptr_conv.is_owned = false;
36921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36922 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36923 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
36927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36928 LDKTxCreationKeys this_ptr_conv;
36929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36930 this_ptr_conv.is_owned = false;
36931 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36932 LDKPublicKey val_ref;
36933 CHECK((*env)->GetArrayLength(env, val) == 33);
36934 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36935 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
36938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36939 LDKTxCreationKeys this_ptr_conv;
36940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36941 this_ptr_conv.is_owned = false;
36942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36943 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36944 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
36948 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) {
36949 LDKTxCreationKeys this_ptr_conv;
36950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36951 this_ptr_conv.is_owned = false;
36952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36953 LDKPublicKey val_ref;
36954 CHECK((*env)->GetArrayLength(env, val) == 33);
36955 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36956 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
36959 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) {
36960 LDKPublicKey per_commitment_point_arg_ref;
36961 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
36962 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
36963 LDKPublicKey revocation_key_arg_ref;
36964 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
36965 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
36966 LDKPublicKey broadcaster_htlc_key_arg_ref;
36967 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
36968 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
36969 LDKPublicKey countersignatory_htlc_key_arg_ref;
36970 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
36971 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
36972 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
36973 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
36974 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
36975 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);
36976 int64_t ret_ref = 0;
36977 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36978 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36979 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36980 ret_ref = (uintptr_t)ret_var.inner;
36981 if (ret_var.is_owned) {
36987 static inline uintptr_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
36988 LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
36989 int64_t ret_ref = 0;
36990 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36991 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36992 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36993 ret_ref = (uintptr_t)ret_var.inner;
36994 if (ret_var.is_owned) {
36999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37000 LDKTxCreationKeys arg_conv;
37001 arg_conv.inner = (void*)(arg & (~1));
37002 arg_conv.is_owned = false;
37003 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37004 int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
37008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37009 LDKTxCreationKeys orig_conv;
37010 orig_conv.inner = (void*)(orig & (~1));
37011 orig_conv.is_owned = false;
37012 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37013 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
37014 int64_t ret_ref = 0;
37015 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37016 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37018 ret_ref = (uintptr_t)ret_var.inner;
37019 if (ret_var.is_owned) {
37025 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
37026 LDKTxCreationKeys obj_conv;
37027 obj_conv.inner = (void*)(obj & (~1));
37028 obj_conv.is_owned = false;
37029 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37030 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
37031 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37032 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37033 CVec_u8Z_free(ret_var);
37037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37038 LDKu8slice ser_ref;
37039 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37040 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37041 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37042 *ret_conv = TxCreationKeys_read(ser_ref);
37043 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37044 return (int64_t)ret_conv;
37047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37048 LDKChannelPublicKeys this_obj_conv;
37049 this_obj_conv.inner = (void*)(this_obj & (~1));
37050 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37052 ChannelPublicKeys_free(this_obj_conv);
37055 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
37056 LDKChannelPublicKeys this_ptr_conv;
37057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37058 this_ptr_conv.is_owned = false;
37059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37060 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37061 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
37065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37066 LDKChannelPublicKeys this_ptr_conv;
37067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37068 this_ptr_conv.is_owned = false;
37069 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37070 LDKPublicKey val_ref;
37071 CHECK((*env)->GetArrayLength(env, val) == 33);
37072 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37073 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
37076 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37077 LDKChannelPublicKeys this_ptr_conv;
37078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37079 this_ptr_conv.is_owned = false;
37080 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37081 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37082 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
37086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37087 LDKChannelPublicKeys this_ptr_conv;
37088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37089 this_ptr_conv.is_owned = false;
37090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37091 LDKPublicKey val_ref;
37092 CHECK((*env)->GetArrayLength(env, val) == 33);
37093 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37094 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
37097 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
37098 LDKChannelPublicKeys this_ptr_conv;
37099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37100 this_ptr_conv.is_owned = false;
37101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37102 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37103 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
37107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37108 LDKChannelPublicKeys this_ptr_conv;
37109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37110 this_ptr_conv.is_owned = false;
37111 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37112 LDKPublicKey val_ref;
37113 CHECK((*env)->GetArrayLength(env, val) == 33);
37114 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37115 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
37118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37119 LDKChannelPublicKeys this_ptr_conv;
37120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37121 this_ptr_conv.is_owned = false;
37122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37123 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37124 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
37128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37129 LDKChannelPublicKeys this_ptr_conv;
37130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37131 this_ptr_conv.is_owned = false;
37132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37133 LDKPublicKey val_ref;
37134 CHECK((*env)->GetArrayLength(env, val) == 33);
37135 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37136 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37140 LDKChannelPublicKeys this_ptr_conv;
37141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37142 this_ptr_conv.is_owned = false;
37143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37144 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
37145 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
37149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37150 LDKChannelPublicKeys this_ptr_conv;
37151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37152 this_ptr_conv.is_owned = false;
37153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37154 LDKPublicKey val_ref;
37155 CHECK((*env)->GetArrayLength(env, val) == 33);
37156 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
37157 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
37160 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) {
37161 LDKPublicKey funding_pubkey_arg_ref;
37162 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
37163 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
37164 LDKPublicKey revocation_basepoint_arg_ref;
37165 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
37166 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
37167 LDKPublicKey payment_point_arg_ref;
37168 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
37169 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
37170 LDKPublicKey delayed_payment_basepoint_arg_ref;
37171 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
37172 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
37173 LDKPublicKey htlc_basepoint_arg_ref;
37174 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
37175 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
37176 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);
37177 int64_t ret_ref = 0;
37178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37181 ret_ref = (uintptr_t)ret_var.inner;
37182 if (ret_var.is_owned) {
37188 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
37189 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
37190 int64_t ret_ref = 0;
37191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37194 ret_ref = (uintptr_t)ret_var.inner;
37195 if (ret_var.is_owned) {
37200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37201 LDKChannelPublicKeys arg_conv;
37202 arg_conv.inner = (void*)(arg & (~1));
37203 arg_conv.is_owned = false;
37204 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37205 int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
37209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37210 LDKChannelPublicKeys orig_conv;
37211 orig_conv.inner = (void*)(orig & (~1));
37212 orig_conv.is_owned = false;
37213 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37214 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
37215 int64_t ret_ref = 0;
37216 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37217 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37219 ret_ref = (uintptr_t)ret_var.inner;
37220 if (ret_var.is_owned) {
37226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
37227 LDKChannelPublicKeys obj_conv;
37228 obj_conv.inner = (void*)(obj & (~1));
37229 obj_conv.is_owned = false;
37230 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37231 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
37232 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37233 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37234 CVec_u8Z_free(ret_var);
37238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37239 LDKu8slice ser_ref;
37240 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37241 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37242 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37243 *ret_conv = ChannelPublicKeys_read(ser_ref);
37244 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37245 return (int64_t)ret_conv;
37248 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) {
37249 LDKPublicKey per_commitment_point_ref;
37250 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37251 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37252 LDKPublicKey broadcaster_delayed_payment_base_ref;
37253 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
37254 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
37255 LDKPublicKey broadcaster_htlc_base_ref;
37256 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
37257 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
37258 LDKPublicKey countersignatory_revocation_base_ref;
37259 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
37260 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
37261 LDKPublicKey countersignatory_htlc_base_ref;
37262 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
37263 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
37264 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
37265 *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);
37266 return (int64_t)ret_conv;
37269 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) {
37270 LDKPublicKey per_commitment_point_ref;
37271 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
37272 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
37273 LDKChannelPublicKeys broadcaster_keys_conv;
37274 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
37275 broadcaster_keys_conv.is_owned = false;
37276 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37277 LDKChannelPublicKeys countersignatory_keys_conv;
37278 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
37279 countersignatory_keys_conv.is_owned = false;
37280 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37281 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
37282 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
37283 return (int64_t)ret_conv;
37286 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) {
37287 LDKPublicKey revocation_key_ref;
37288 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
37289 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
37290 LDKPublicKey broadcaster_delayed_payment_key_ref;
37291 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
37292 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
37293 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
37294 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37295 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37296 CVec_u8Z_free(ret_var);
37300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37301 LDKHTLCOutputInCommitment this_obj_conv;
37302 this_obj_conv.inner = (void*)(this_obj & (~1));
37303 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37305 HTLCOutputInCommitment_free(this_obj_conv);
37308 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
37309 LDKHTLCOutputInCommitment this_ptr_conv;
37310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37311 this_ptr_conv.is_owned = false;
37312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37313 jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
37317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37318 LDKHTLCOutputInCommitment this_ptr_conv;
37319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37320 this_ptr_conv.is_owned = false;
37321 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37322 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
37325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
37326 LDKHTLCOutputInCommitment this_ptr_conv;
37327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37328 this_ptr_conv.is_owned = false;
37329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37330 int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
37334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37335 LDKHTLCOutputInCommitment this_ptr_conv;
37336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37337 this_ptr_conv.is_owned = false;
37338 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37339 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
37342 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
37343 LDKHTLCOutputInCommitment this_ptr_conv;
37344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37345 this_ptr_conv.is_owned = false;
37346 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37347 int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
37351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
37352 LDKHTLCOutputInCommitment this_ptr_conv;
37353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37354 this_ptr_conv.is_owned = false;
37355 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37356 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
37359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
37360 LDKHTLCOutputInCommitment this_ptr_conv;
37361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37362 this_ptr_conv.is_owned = false;
37363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37364 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37365 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
37369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37370 LDKHTLCOutputInCommitment this_ptr_conv;
37371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37372 this_ptr_conv.is_owned = false;
37373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37374 LDKThirtyTwoBytes val_ref;
37375 CHECK((*env)->GetArrayLength(env, val) == 32);
37376 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37377 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
37380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
37381 LDKHTLCOutputInCommitment this_ptr_conv;
37382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37383 this_ptr_conv.is_owned = false;
37384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37385 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37386 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
37387 int64_t ret_ref = (uintptr_t)ret_copy;
37391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37392 LDKHTLCOutputInCommitment this_ptr_conv;
37393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37394 this_ptr_conv.is_owned = false;
37395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37396 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
37397 CHECK_ACCESS(val_ptr);
37398 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37399 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
37400 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
37403 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) {
37404 LDKThirtyTwoBytes payment_hash_arg_ref;
37405 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
37406 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
37407 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
37408 CHECK_ACCESS(transaction_output_index_arg_ptr);
37409 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
37410 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
37411 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
37412 int64_t ret_ref = 0;
37413 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37414 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37416 ret_ref = (uintptr_t)ret_var.inner;
37417 if (ret_var.is_owned) {
37423 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
37424 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
37425 int64_t ret_ref = 0;
37426 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37427 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37428 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37429 ret_ref = (uintptr_t)ret_var.inner;
37430 if (ret_var.is_owned) {
37435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37436 LDKHTLCOutputInCommitment arg_conv;
37437 arg_conv.inner = (void*)(arg & (~1));
37438 arg_conv.is_owned = false;
37439 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37440 int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
37444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37445 LDKHTLCOutputInCommitment orig_conv;
37446 orig_conv.inner = (void*)(orig & (~1));
37447 orig_conv.is_owned = false;
37448 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37449 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
37450 int64_t ret_ref = 0;
37451 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37452 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37453 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37454 ret_ref = (uintptr_t)ret_var.inner;
37455 if (ret_var.is_owned) {
37461 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
37462 LDKHTLCOutputInCommitment obj_conv;
37463 obj_conv.inner = (void*)(obj & (~1));
37464 obj_conv.is_owned = false;
37465 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37466 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
37467 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37468 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37469 CVec_u8Z_free(ret_var);
37473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37474 LDKu8slice ser_ref;
37475 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37476 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37477 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
37478 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
37479 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37480 return (int64_t)ret_conv;
37483 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) {
37484 LDKHTLCOutputInCommitment htlc_conv;
37485 htlc_conv.inner = (void*)(htlc & (~1));
37486 htlc_conv.is_owned = false;
37487 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
37488 LDKTxCreationKeys keys_conv;
37489 keys_conv.inner = (void*)(keys & (~1));
37490 keys_conv.is_owned = false;
37491 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
37492 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
37493 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37494 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37495 CVec_u8Z_free(ret_var);
37499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
37500 LDKPublicKey broadcaster_ref;
37501 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
37502 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
37503 LDKPublicKey countersignatory_ref;
37504 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
37505 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
37506 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
37507 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37508 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37509 CVec_u8Z_free(ret_var);
37513 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) {
37514 unsigned char commitment_txid_arr[32];
37515 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
37516 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
37517 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
37518 LDKHTLCOutputInCommitment htlc_conv;
37519 htlc_conv.inner = (void*)(htlc & (~1));
37520 htlc_conv.is_owned = false;
37521 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
37522 LDKPublicKey broadcaster_delayed_payment_key_ref;
37523 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
37524 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
37525 LDKPublicKey revocation_key_ref;
37526 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
37527 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
37528 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);
37529 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37530 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37531 Transaction_free(ret_var);
37535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
37536 LDKPublicKey funding_pubkey_ref;
37537 CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
37538 (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
37539 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
37540 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37541 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37542 CVec_u8Z_free(ret_var);
37546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37547 LDKChannelTransactionParameters this_obj_conv;
37548 this_obj_conv.inner = (void*)(this_obj & (~1));
37549 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37550 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37551 ChannelTransactionParameters_free(this_obj_conv);
37554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
37555 LDKChannelTransactionParameters this_ptr_conv;
37556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37557 this_ptr_conv.is_owned = false;
37558 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37559 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
37560 int64_t ret_ref = 0;
37561 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37562 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37564 ret_ref = (uintptr_t)ret_var.inner;
37565 if (ret_var.is_owned) {
37571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37572 LDKChannelTransactionParameters this_ptr_conv;
37573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37574 this_ptr_conv.is_owned = false;
37575 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37576 LDKChannelPublicKeys val_conv;
37577 val_conv.inner = (void*)(val & (~1));
37578 val_conv.is_owned = (val & 1) || (val == 0);
37579 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37580 val_conv = ChannelPublicKeys_clone(&val_conv);
37581 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
37584 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
37585 LDKChannelTransactionParameters this_ptr_conv;
37586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37587 this_ptr_conv.is_owned = false;
37588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37589 int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
37593 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) {
37594 LDKChannelTransactionParameters this_ptr_conv;
37595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37596 this_ptr_conv.is_owned = false;
37597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37598 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
37601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
37602 LDKChannelTransactionParameters this_ptr_conv;
37603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37604 this_ptr_conv.is_owned = false;
37605 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37606 jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
37610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37611 LDKChannelTransactionParameters this_ptr_conv;
37612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37613 this_ptr_conv.is_owned = false;
37614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37615 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
37618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
37619 LDKChannelTransactionParameters this_ptr_conv;
37620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37621 this_ptr_conv.is_owned = false;
37622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37623 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
37624 int64_t ret_ref = 0;
37625 if ((uintptr_t)ret_var.inner > 4096) {
37626 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37627 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37628 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37629 ret_ref = (uintptr_t)ret_var.inner;
37630 if (ret_var.is_owned) {
37637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37638 LDKChannelTransactionParameters this_ptr_conv;
37639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37640 this_ptr_conv.is_owned = false;
37641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37642 LDKCounterpartyChannelTransactionParameters val_conv;
37643 val_conv.inner = (void*)(val & (~1));
37644 val_conv.is_owned = (val & 1) || (val == 0);
37645 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37646 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
37647 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
37650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37651 LDKChannelTransactionParameters this_ptr_conv;
37652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37653 this_ptr_conv.is_owned = false;
37654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37655 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
37656 int64_t ret_ref = 0;
37657 if ((uintptr_t)ret_var.inner > 4096) {
37658 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37659 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37660 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37661 ret_ref = (uintptr_t)ret_var.inner;
37662 if (ret_var.is_owned) {
37669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37670 LDKChannelTransactionParameters this_ptr_conv;
37671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37672 this_ptr_conv.is_owned = false;
37673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37674 LDKOutPoint val_conv;
37675 val_conv.inner = (void*)(val & (~1));
37676 val_conv.is_owned = (val & 1) || (val == 0);
37677 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37678 val_conv = OutPoint_clone(&val_conv);
37679 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
37682 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
37683 LDKChannelTransactionParameters this_ptr_conv;
37684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37685 this_ptr_conv.is_owned = false;
37686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37687 jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
37691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
37692 LDKChannelTransactionParameters this_ptr_conv;
37693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37694 this_ptr_conv.is_owned = false;
37695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37696 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
37697 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
37700 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) {
37701 LDKChannelPublicKeys holder_pubkeys_arg_conv;
37702 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
37703 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
37704 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
37705 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
37706 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
37707 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
37708 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
37709 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
37710 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
37711 LDKOutPoint funding_outpoint_arg_conv;
37712 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
37713 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
37714 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
37715 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
37716 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
37717 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);
37718 int64_t ret_ref = 0;
37719 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37720 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37721 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37722 ret_ref = (uintptr_t)ret_var.inner;
37723 if (ret_var.is_owned) {
37729 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
37730 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
37731 int64_t ret_ref = 0;
37732 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37733 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37735 ret_ref = (uintptr_t)ret_var.inner;
37736 if (ret_var.is_owned) {
37741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37742 LDKChannelTransactionParameters arg_conv;
37743 arg_conv.inner = (void*)(arg & (~1));
37744 arg_conv.is_owned = false;
37745 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37746 int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
37750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37751 LDKChannelTransactionParameters orig_conv;
37752 orig_conv.inner = (void*)(orig & (~1));
37753 orig_conv.is_owned = false;
37754 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37755 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
37756 int64_t ret_ref = 0;
37757 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37758 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37760 ret_ref = (uintptr_t)ret_var.inner;
37761 if (ret_var.is_owned) {
37767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37768 LDKCounterpartyChannelTransactionParameters this_obj_conv;
37769 this_obj_conv.inner = (void*)(this_obj & (~1));
37770 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37772 CounterpartyChannelTransactionParameters_free(this_obj_conv);
37775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
37776 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37778 this_ptr_conv.is_owned = false;
37779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37780 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
37781 int64_t ret_ref = 0;
37782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37785 ret_ref = (uintptr_t)ret_var.inner;
37786 if (ret_var.is_owned) {
37792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37793 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37795 this_ptr_conv.is_owned = false;
37796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37797 LDKChannelPublicKeys val_conv;
37798 val_conv.inner = (void*)(val & (~1));
37799 val_conv.is_owned = (val & 1) || (val == 0);
37800 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37801 val_conv = ChannelPublicKeys_clone(&val_conv);
37802 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
37805 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
37806 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37808 this_ptr_conv.is_owned = false;
37809 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37810 int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
37814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
37815 LDKCounterpartyChannelTransactionParameters 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 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
37822 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) {
37823 LDKChannelPublicKeys pubkeys_arg_conv;
37824 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
37825 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
37826 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
37827 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
37828 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
37829 int64_t ret_ref = 0;
37830 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37831 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37832 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37833 ret_ref = (uintptr_t)ret_var.inner;
37834 if (ret_var.is_owned) {
37840 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
37841 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
37842 int64_t ret_ref = 0;
37843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37844 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
37847 if (ret_var.is_owned) {
37852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37853 LDKCounterpartyChannelTransactionParameters arg_conv;
37854 arg_conv.inner = (void*)(arg & (~1));
37855 arg_conv.is_owned = false;
37856 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37857 int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
37861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37862 LDKCounterpartyChannelTransactionParameters orig_conv;
37863 orig_conv.inner = (void*)(orig & (~1));
37864 orig_conv.is_owned = false;
37865 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37866 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
37867 int64_t ret_ref = 0;
37868 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37869 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37870 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37871 ret_ref = (uintptr_t)ret_var.inner;
37872 if (ret_var.is_owned) {
37878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
37879 LDKChannelTransactionParameters this_arg_conv;
37880 this_arg_conv.inner = (void*)(this_arg & (~1));
37881 this_arg_conv.is_owned = false;
37882 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37883 jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
37887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
37888 LDKChannelTransactionParameters this_arg_conv;
37889 this_arg_conv.inner = (void*)(this_arg & (~1));
37890 this_arg_conv.is_owned = false;
37891 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37892 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
37893 int64_t ret_ref = 0;
37894 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37895 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37897 ret_ref = (uintptr_t)ret_var.inner;
37898 if (ret_var.is_owned) {
37904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
37905 LDKChannelTransactionParameters this_arg_conv;
37906 this_arg_conv.inner = (void*)(this_arg & (~1));
37907 this_arg_conv.is_owned = false;
37908 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37909 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
37910 int64_t ret_ref = 0;
37911 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37912 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37913 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37914 ret_ref = (uintptr_t)ret_var.inner;
37915 if (ret_var.is_owned) {
37921 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
37922 LDKCounterpartyChannelTransactionParameters obj_conv;
37923 obj_conv.inner = (void*)(obj & (~1));
37924 obj_conv.is_owned = false;
37925 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37926 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
37927 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37928 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37929 CVec_u8Z_free(ret_var);
37933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37934 LDKu8slice ser_ref;
37935 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37936 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37937 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
37938 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
37939 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37940 return (int64_t)ret_conv;
37943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
37944 LDKChannelTransactionParameters obj_conv;
37945 obj_conv.inner = (void*)(obj & (~1));
37946 obj_conv.is_owned = false;
37947 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37948 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
37949 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37950 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37951 CVec_u8Z_free(ret_var);
37955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37956 LDKu8slice ser_ref;
37957 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37958 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37959 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
37960 *ret_conv = ChannelTransactionParameters_read(ser_ref);
37961 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37962 return (int64_t)ret_conv;
37965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37966 LDKDirectedChannelTransactionParameters this_obj_conv;
37967 this_obj_conv.inner = (void*)(this_obj & (~1));
37968 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37970 DirectedChannelTransactionParameters_free(this_obj_conv);
37973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
37974 LDKDirectedChannelTransactionParameters this_arg_conv;
37975 this_arg_conv.inner = (void*)(this_arg & (~1));
37976 this_arg_conv.is_owned = false;
37977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37978 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
37979 int64_t ret_ref = 0;
37980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37983 ret_ref = (uintptr_t)ret_var.inner;
37984 if (ret_var.is_owned) {
37990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
37991 LDKDirectedChannelTransactionParameters this_arg_conv;
37992 this_arg_conv.inner = (void*)(this_arg & (~1));
37993 this_arg_conv.is_owned = false;
37994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37995 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
37996 int64_t ret_ref = 0;
37997 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37998 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37999 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38000 ret_ref = (uintptr_t)ret_var.inner;
38001 if (ret_var.is_owned) {
38007 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
38008 LDKDirectedChannelTransactionParameters this_arg_conv;
38009 this_arg_conv.inner = (void*)(this_arg & (~1));
38010 this_arg_conv.is_owned = false;
38011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38012 int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
38016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
38017 LDKDirectedChannelTransactionParameters this_arg_conv;
38018 this_arg_conv.inner = (void*)(this_arg & (~1));
38019 this_arg_conv.is_owned = false;
38020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38021 jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
38025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
38026 LDKDirectedChannelTransactionParameters this_arg_conv;
38027 this_arg_conv.inner = (void*)(this_arg & (~1));
38028 this_arg_conv.is_owned = false;
38029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38030 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
38031 int64_t ret_ref = 0;
38032 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38033 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38034 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38035 ret_ref = (uintptr_t)ret_var.inner;
38036 if (ret_var.is_owned) {
38042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
38043 LDKDirectedChannelTransactionParameters this_arg_conv;
38044 this_arg_conv.inner = (void*)(this_arg & (~1));
38045 this_arg_conv.is_owned = false;
38046 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38047 jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
38051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38052 LDKHolderCommitmentTransaction this_obj_conv;
38053 this_obj_conv.inner = (void*)(this_obj & (~1));
38054 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38056 HolderCommitmentTransaction_free(this_obj_conv);
38059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
38060 LDKHolderCommitmentTransaction this_ptr_conv;
38061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38062 this_ptr_conv.is_owned = false;
38063 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38064 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38065 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
38069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38070 LDKHolderCommitmentTransaction this_ptr_conv;
38071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38072 this_ptr_conv.is_owned = false;
38073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38074 LDKSignature val_ref;
38075 CHECK((*env)->GetArrayLength(env, val) == 64);
38076 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
38077 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
38080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
38081 LDKHolderCommitmentTransaction this_ptr_conv;
38082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38083 this_ptr_conv.is_owned = false;
38084 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38085 LDKCVec_SignatureZ val_constr;
38086 val_constr.datalen = (*env)->GetArrayLength(env, val);
38087 if (val_constr.datalen > 0)
38088 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38090 val_constr.data = NULL;
38091 for (size_t i = 0; i < val_constr.datalen; i++) {
38092 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
38093 LDKSignature val_conv_8_ref;
38094 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
38095 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
38096 val_constr.data[i] = val_conv_8_ref;
38098 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
38101 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
38102 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
38103 int64_t ret_ref = 0;
38104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38107 ret_ref = (uintptr_t)ret_var.inner;
38108 if (ret_var.is_owned) {
38113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38114 LDKHolderCommitmentTransaction arg_conv;
38115 arg_conv.inner = (void*)(arg & (~1));
38116 arg_conv.is_owned = false;
38117 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38118 int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
38122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38123 LDKHolderCommitmentTransaction orig_conv;
38124 orig_conv.inner = (void*)(orig & (~1));
38125 orig_conv.is_owned = false;
38126 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38127 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
38128 int64_t ret_ref = 0;
38129 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38130 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38131 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38132 ret_ref = (uintptr_t)ret_var.inner;
38133 if (ret_var.is_owned) {
38139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38140 LDKHolderCommitmentTransaction obj_conv;
38141 obj_conv.inner = (void*)(obj & (~1));
38142 obj_conv.is_owned = false;
38143 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38144 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
38145 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38146 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38147 CVec_u8Z_free(ret_var);
38151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38152 LDKu8slice ser_ref;
38153 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38154 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38155 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
38156 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
38157 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38158 return (int64_t)ret_conv;
38161 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) {
38162 LDKCommitmentTransaction commitment_tx_conv;
38163 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
38164 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
38165 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
38166 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
38167 LDKSignature counterparty_sig_ref;
38168 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
38169 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
38170 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
38171 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
38172 if (counterparty_htlc_sigs_constr.datalen > 0)
38173 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38175 counterparty_htlc_sigs_constr.data = NULL;
38176 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
38177 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
38178 LDKSignature counterparty_htlc_sigs_conv_8_ref;
38179 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
38180 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
38181 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
38183 LDKPublicKey holder_funding_key_ref;
38184 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
38185 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
38186 LDKPublicKey counterparty_funding_key_ref;
38187 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
38188 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
38189 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
38190 int64_t ret_ref = 0;
38191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38194 ret_ref = (uintptr_t)ret_var.inner;
38195 if (ret_var.is_owned) {
38201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38202 LDKBuiltCommitmentTransaction this_obj_conv;
38203 this_obj_conv.inner = (void*)(this_obj & (~1));
38204 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38206 BuiltCommitmentTransaction_free(this_obj_conv);
38209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
38210 LDKBuiltCommitmentTransaction this_ptr_conv;
38211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38212 this_ptr_conv.is_owned = false;
38213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38214 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
38215 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38216 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38217 Transaction_free(ret_var);
38221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38222 LDKBuiltCommitmentTransaction this_ptr_conv;
38223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38224 this_ptr_conv.is_owned = false;
38225 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38226 LDKTransaction val_ref;
38227 val_ref.datalen = (*env)->GetArrayLength(env, val);
38228 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
38229 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
38230 val_ref.data_is_owned = true;
38231 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
38234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
38235 LDKBuiltCommitmentTransaction this_ptr_conv;
38236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38237 this_ptr_conv.is_owned = false;
38238 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38239 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38240 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
38244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38245 LDKBuiltCommitmentTransaction this_ptr_conv;
38246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38247 this_ptr_conv.is_owned = false;
38248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38249 LDKThirtyTwoBytes val_ref;
38250 CHECK((*env)->GetArrayLength(env, val) == 32);
38251 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
38252 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
38255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
38256 LDKTransaction transaction_arg_ref;
38257 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
38258 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
38259 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
38260 transaction_arg_ref.data_is_owned = true;
38261 LDKThirtyTwoBytes txid_arg_ref;
38262 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
38263 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
38264 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
38265 int64_t ret_ref = 0;
38266 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38267 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38268 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38269 ret_ref = (uintptr_t)ret_var.inner;
38270 if (ret_var.is_owned) {
38276 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
38277 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
38278 int64_t ret_ref = 0;
38279 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38280 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38281 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38282 ret_ref = (uintptr_t)ret_var.inner;
38283 if (ret_var.is_owned) {
38288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38289 LDKBuiltCommitmentTransaction arg_conv;
38290 arg_conv.inner = (void*)(arg & (~1));
38291 arg_conv.is_owned = false;
38292 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38293 int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
38297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38298 LDKBuiltCommitmentTransaction orig_conv;
38299 orig_conv.inner = (void*)(orig & (~1));
38300 orig_conv.is_owned = false;
38301 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38302 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
38303 int64_t ret_ref = 0;
38304 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38305 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38306 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38307 ret_ref = (uintptr_t)ret_var.inner;
38308 if (ret_var.is_owned) {
38314 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38315 LDKBuiltCommitmentTransaction obj_conv;
38316 obj_conv.inner = (void*)(obj & (~1));
38317 obj_conv.is_owned = false;
38318 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38319 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
38320 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38321 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38322 CVec_u8Z_free(ret_var);
38326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38327 LDKu8slice ser_ref;
38328 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38329 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38330 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
38331 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
38332 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38333 return (int64_t)ret_conv;
38336 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) {
38337 LDKBuiltCommitmentTransaction this_arg_conv;
38338 this_arg_conv.inner = (void*)(this_arg & (~1));
38339 this_arg_conv.is_owned = false;
38340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38341 LDKu8slice funding_redeemscript_ref;
38342 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38343 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38344 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38345 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
38346 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38350 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) {
38351 LDKBuiltCommitmentTransaction this_arg_conv;
38352 this_arg_conv.inner = (void*)(this_arg & (~1));
38353 this_arg_conv.is_owned = false;
38354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38355 unsigned char funding_key_arr[32];
38356 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
38357 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
38358 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
38359 LDKu8slice funding_redeemscript_ref;
38360 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38361 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38362 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38363 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
38364 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38369 LDKClosingTransaction this_obj_conv;
38370 this_obj_conv.inner = (void*)(this_obj & (~1));
38371 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38372 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38373 ClosingTransaction_free(this_obj_conv);
38376 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
38377 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
38378 int64_t ret_ref = 0;
38379 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38380 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38381 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38382 ret_ref = (uintptr_t)ret_var.inner;
38383 if (ret_var.is_owned) {
38388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38389 LDKClosingTransaction arg_conv;
38390 arg_conv.inner = (void*)(arg & (~1));
38391 arg_conv.is_owned = false;
38392 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38393 int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
38397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38398 LDKClosingTransaction orig_conv;
38399 orig_conv.inner = (void*)(orig & (~1));
38400 orig_conv.is_owned = false;
38401 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38402 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
38403 int64_t ret_ref = 0;
38404 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38405 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38406 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38407 ret_ref = (uintptr_t)ret_var.inner;
38408 if (ret_var.is_owned) {
38414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
38415 LDKClosingTransaction o_conv;
38416 o_conv.inner = (void*)(o & (~1));
38417 o_conv.is_owned = false;
38418 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38419 int64_t ret_conv = ClosingTransaction_hash(&o_conv);
38423 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) {
38424 LDKCVec_u8Z to_holder_script_ref;
38425 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
38426 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
38427 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
38428 LDKCVec_u8Z to_counterparty_script_ref;
38429 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
38430 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
38431 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
38432 LDKOutPoint funding_outpoint_conv;
38433 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
38434 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
38435 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38436 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38437 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
38438 int64_t ret_ref = 0;
38439 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38440 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
38443 if (ret_var.is_owned) {
38449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
38450 LDKClosingTransaction this_arg_conv;
38451 this_arg_conv.inner = (void*)(this_arg & (~1));
38452 this_arg_conv.is_owned = false;
38453 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38454 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
38455 int64_t ret_ref = 0;
38456 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38457 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38458 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38459 ret_ref = (uintptr_t)ret_var.inner;
38460 if (ret_var.is_owned) {
38466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
38467 LDKClosingTransaction this_arg_conv;
38468 this_arg_conv.inner = (void*)(this_arg & (~1));
38469 this_arg_conv.is_owned = false;
38470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38471 LDKOutPoint funding_outpoint_conv;
38472 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
38473 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
38474 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38475 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38476 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
38477 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
38478 return (int64_t)ret_conv;
38481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38482 LDKClosingTransaction this_arg_conv;
38483 this_arg_conv.inner = (void*)(this_arg & (~1));
38484 this_arg_conv.is_owned = false;
38485 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38486 int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
38490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38491 LDKClosingTransaction this_arg_conv;
38492 this_arg_conv.inner = (void*)(this_arg & (~1));
38493 this_arg_conv.is_owned = false;
38494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38495 int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
38499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
38500 LDKClosingTransaction this_arg_conv;
38501 this_arg_conv.inner = (void*)(this_arg & (~1));
38502 this_arg_conv.is_owned = false;
38503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38504 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
38505 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38506 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
38511 LDKClosingTransaction this_arg_conv;
38512 this_arg_conv.inner = (void*)(this_arg & (~1));
38513 this_arg_conv.is_owned = false;
38514 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38515 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
38516 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38517 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38522 LDKTrustedClosingTransaction this_obj_conv;
38523 this_obj_conv.inner = (void*)(this_obj & (~1));
38524 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38525 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38526 TrustedClosingTransaction_free(this_obj_conv);
38529 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
38530 LDKTrustedClosingTransaction this_arg_conv;
38531 this_arg_conv.inner = (void*)(this_arg & (~1));
38532 this_arg_conv.is_owned = false;
38533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38534 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
38535 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38536 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38537 Transaction_free(ret_var);
38541 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) {
38542 LDKTrustedClosingTransaction this_arg_conv;
38543 this_arg_conv.inner = (void*)(this_arg & (~1));
38544 this_arg_conv.is_owned = false;
38545 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38546 LDKu8slice funding_redeemscript_ref;
38547 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38548 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38549 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38550 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
38551 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38555 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) {
38556 LDKTrustedClosingTransaction this_arg_conv;
38557 this_arg_conv.inner = (void*)(this_arg & (~1));
38558 this_arg_conv.is_owned = false;
38559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38560 unsigned char funding_key_arr[32];
38561 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
38562 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
38563 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
38564 LDKu8slice funding_redeemscript_ref;
38565 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
38566 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
38567 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
38568 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
38569 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38574 LDKCommitmentTransaction this_obj_conv;
38575 this_obj_conv.inner = (void*)(this_obj & (~1));
38576 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38577 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38578 CommitmentTransaction_free(this_obj_conv);
38581 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
38582 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
38583 int64_t ret_ref = 0;
38584 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38585 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38586 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38587 ret_ref = (uintptr_t)ret_var.inner;
38588 if (ret_var.is_owned) {
38593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38594 LDKCommitmentTransaction arg_conv;
38595 arg_conv.inner = (void*)(arg & (~1));
38596 arg_conv.is_owned = false;
38597 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38598 int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
38602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38603 LDKCommitmentTransaction orig_conv;
38604 orig_conv.inner = (void*)(orig & (~1));
38605 orig_conv.is_owned = false;
38606 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38607 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
38608 int64_t ret_ref = 0;
38609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38612 ret_ref = (uintptr_t)ret_var.inner;
38613 if (ret_var.is_owned) {
38619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38620 LDKCommitmentTransaction obj_conv;
38621 obj_conv.inner = (void*)(obj & (~1));
38622 obj_conv.is_owned = false;
38623 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38624 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
38625 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38626 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38627 CVec_u8Z_free(ret_var);
38631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38632 LDKu8slice ser_ref;
38633 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38634 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38635 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
38636 *ret_conv = CommitmentTransaction_read(ser_ref);
38637 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38638 return (int64_t)ret_conv;
38641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
38642 LDKCommitmentTransaction this_arg_conv;
38643 this_arg_conv.inner = (void*)(this_arg & (~1));
38644 this_arg_conv.is_owned = false;
38645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38646 int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
38650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38651 LDKCommitmentTransaction this_arg_conv;
38652 this_arg_conv.inner = (void*)(this_arg & (~1));
38653 this_arg_conv.is_owned = false;
38654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38655 int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
38659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38660 LDKCommitmentTransaction this_arg_conv;
38661 this_arg_conv.inner = (void*)(this_arg & (~1));
38662 this_arg_conv.is_owned = false;
38663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38664 int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
38668 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
38669 LDKCommitmentTransaction this_arg_conv;
38670 this_arg_conv.inner = (void*)(this_arg & (~1));
38671 this_arg_conv.is_owned = false;
38672 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38673 int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
38677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
38678 LDKCommitmentTransaction this_arg_conv;
38679 this_arg_conv.inner = (void*)(this_arg & (~1));
38680 this_arg_conv.is_owned = false;
38681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38682 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
38683 int64_t ret_ref = 0;
38684 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38685 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38686 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38687 ret_ref = (uintptr_t)ret_var.inner;
38688 if (ret_var.is_owned) {
38694 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) {
38695 LDKCommitmentTransaction this_arg_conv;
38696 this_arg_conv.inner = (void*)(this_arg & (~1));
38697 this_arg_conv.is_owned = false;
38698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38699 LDKDirectedChannelTransactionParameters channel_parameters_conv;
38700 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
38701 channel_parameters_conv.is_owned = false;
38702 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38703 LDKChannelPublicKeys broadcaster_keys_conv;
38704 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
38705 broadcaster_keys_conv.is_owned = false;
38706 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38707 LDKChannelPublicKeys countersignatory_keys_conv;
38708 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
38709 countersignatory_keys_conv.is_owned = false;
38710 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38711 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
38712 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
38713 return (int64_t)ret_conv;
38716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38717 LDKTrustedCommitmentTransaction this_obj_conv;
38718 this_obj_conv.inner = (void*)(this_obj & (~1));
38719 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38720 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38721 TrustedCommitmentTransaction_free(this_obj_conv);
38724 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
38725 LDKTrustedCommitmentTransaction this_arg_conv;
38726 this_arg_conv.inner = (void*)(this_arg & (~1));
38727 this_arg_conv.is_owned = false;
38728 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38729 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38730 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
38734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
38735 LDKTrustedCommitmentTransaction this_arg_conv;
38736 this_arg_conv.inner = (void*)(this_arg & (~1));
38737 this_arg_conv.is_owned = false;
38738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38739 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
38740 int64_t ret_ref = 0;
38741 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38742 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38743 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38744 ret_ref = (uintptr_t)ret_var.inner;
38745 if (ret_var.is_owned) {
38751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
38752 LDKTrustedCommitmentTransaction this_arg_conv;
38753 this_arg_conv.inner = (void*)(this_arg & (~1));
38754 this_arg_conv.is_owned = false;
38755 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38756 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
38757 int64_t ret_ref = 0;
38758 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38759 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38760 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38761 ret_ref = (uintptr_t)ret_var.inner;
38762 if (ret_var.is_owned) {
38768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
38769 LDKTrustedCommitmentTransaction this_arg_conv;
38770 this_arg_conv.inner = (void*)(this_arg & (~1));
38771 this_arg_conv.is_owned = false;
38772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38773 jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
38777 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) {
38778 LDKTrustedCommitmentTransaction this_arg_conv;
38779 this_arg_conv.inner = (void*)(this_arg & (~1));
38780 this_arg_conv.is_owned = false;
38781 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38782 unsigned char htlc_base_key_arr[32];
38783 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
38784 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
38785 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
38786 LDKDirectedChannelTransactionParameters channel_parameters_conv;
38787 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
38788 channel_parameters_conv.is_owned = false;
38789 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38790 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
38791 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
38792 return (int64_t)ret_conv;
38795 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) {
38796 LDKPublicKey broadcaster_payment_basepoint_ref;
38797 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
38798 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
38799 LDKPublicKey countersignatory_payment_basepoint_ref;
38800 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
38801 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
38802 int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
38806 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38807 LDKInitFeatures a_conv;
38808 a_conv.inner = (void*)(a & (~1));
38809 a_conv.is_owned = false;
38810 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38811 LDKInitFeatures b_conv;
38812 b_conv.inner = (void*)(b & (~1));
38813 b_conv.is_owned = false;
38814 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38815 jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
38819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38820 LDKNodeFeatures a_conv;
38821 a_conv.inner = (void*)(a & (~1));
38822 a_conv.is_owned = false;
38823 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38824 LDKNodeFeatures b_conv;
38825 b_conv.inner = (void*)(b & (~1));
38826 b_conv.is_owned = false;
38827 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38828 jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
38832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38833 LDKChannelFeatures a_conv;
38834 a_conv.inner = (void*)(a & (~1));
38835 a_conv.is_owned = false;
38836 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38837 LDKChannelFeatures b_conv;
38838 b_conv.inner = (void*)(b & (~1));
38839 b_conv.is_owned = false;
38840 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38841 jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
38845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38846 LDKInvoiceFeatures a_conv;
38847 a_conv.inner = (void*)(a & (~1));
38848 a_conv.is_owned = false;
38849 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38850 LDKInvoiceFeatures b_conv;
38851 b_conv.inner = (void*)(b & (~1));
38852 b_conv.is_owned = false;
38853 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38854 jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
38858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38859 LDKChannelTypeFeatures a_conv;
38860 a_conv.inner = (void*)(a & (~1));
38861 a_conv.is_owned = false;
38862 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38863 LDKChannelTypeFeatures b_conv;
38864 b_conv.inner = (void*)(b & (~1));
38865 b_conv.is_owned = false;
38866 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38867 jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
38871 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
38872 LDKInitFeatures ret_var = InitFeatures_clone(arg);
38873 int64_t ret_ref = 0;
38874 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38875 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38877 ret_ref = (uintptr_t)ret_var.inner;
38878 if (ret_var.is_owned) {
38883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38884 LDKInitFeatures arg_conv;
38885 arg_conv.inner = (void*)(arg & (~1));
38886 arg_conv.is_owned = false;
38887 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38888 int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
38892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38893 LDKInitFeatures orig_conv;
38894 orig_conv.inner = (void*)(orig & (~1));
38895 orig_conv.is_owned = false;
38896 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38897 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
38898 int64_t ret_ref = 0;
38899 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38900 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38901 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38902 ret_ref = (uintptr_t)ret_var.inner;
38903 if (ret_var.is_owned) {
38909 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
38910 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
38911 int64_t ret_ref = 0;
38912 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38913 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38914 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38915 ret_ref = (uintptr_t)ret_var.inner;
38916 if (ret_var.is_owned) {
38921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38922 LDKNodeFeatures arg_conv;
38923 arg_conv.inner = (void*)(arg & (~1));
38924 arg_conv.is_owned = false;
38925 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38926 int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
38930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38931 LDKNodeFeatures orig_conv;
38932 orig_conv.inner = (void*)(orig & (~1));
38933 orig_conv.is_owned = false;
38934 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38935 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
38936 int64_t ret_ref = 0;
38937 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38938 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38940 ret_ref = (uintptr_t)ret_var.inner;
38941 if (ret_var.is_owned) {
38947 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
38948 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
38949 int64_t ret_ref = 0;
38950 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38951 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38952 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38953 ret_ref = (uintptr_t)ret_var.inner;
38954 if (ret_var.is_owned) {
38959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38960 LDKChannelFeatures arg_conv;
38961 arg_conv.inner = (void*)(arg & (~1));
38962 arg_conv.is_owned = false;
38963 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38964 int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
38968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38969 LDKChannelFeatures orig_conv;
38970 orig_conv.inner = (void*)(orig & (~1));
38971 orig_conv.is_owned = false;
38972 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38973 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
38974 int64_t ret_ref = 0;
38975 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38976 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38978 ret_ref = (uintptr_t)ret_var.inner;
38979 if (ret_var.is_owned) {
38985 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
38986 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
38987 int64_t ret_ref = 0;
38988 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38989 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38991 ret_ref = (uintptr_t)ret_var.inner;
38992 if (ret_var.is_owned) {
38997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38998 LDKInvoiceFeatures arg_conv;
38999 arg_conv.inner = (void*)(arg & (~1));
39000 arg_conv.is_owned = false;
39001 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39002 int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
39006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39007 LDKInvoiceFeatures orig_conv;
39008 orig_conv.inner = (void*)(orig & (~1));
39009 orig_conv.is_owned = false;
39010 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39011 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
39012 int64_t ret_ref = 0;
39013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39016 ret_ref = (uintptr_t)ret_var.inner;
39017 if (ret_var.is_owned) {
39023 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
39024 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
39025 int64_t ret_ref = 0;
39026 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39027 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39028 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39029 ret_ref = (uintptr_t)ret_var.inner;
39030 if (ret_var.is_owned) {
39035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39036 LDKChannelTypeFeatures arg_conv;
39037 arg_conv.inner = (void*)(arg & (~1));
39038 arg_conv.is_owned = false;
39039 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39040 int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
39044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39045 LDKChannelTypeFeatures orig_conv;
39046 orig_conv.inner = (void*)(orig & (~1));
39047 orig_conv.is_owned = false;
39048 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39049 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
39050 int64_t ret_ref = 0;
39051 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39052 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39053 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39054 ret_ref = (uintptr_t)ret_var.inner;
39055 if (ret_var.is_owned) {
39061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39062 LDKInitFeatures this_obj_conv;
39063 this_obj_conv.inner = (void*)(this_obj & (~1));
39064 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39066 InitFeatures_free(this_obj_conv);
39069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39070 LDKNodeFeatures this_obj_conv;
39071 this_obj_conv.inner = (void*)(this_obj & (~1));
39072 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39074 NodeFeatures_free(this_obj_conv);
39077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39078 LDKChannelFeatures this_obj_conv;
39079 this_obj_conv.inner = (void*)(this_obj & (~1));
39080 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39082 ChannelFeatures_free(this_obj_conv);
39085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39086 LDKInvoiceFeatures this_obj_conv;
39087 this_obj_conv.inner = (void*)(this_obj & (~1));
39088 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39090 InvoiceFeatures_free(this_obj_conv);
39093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39094 LDKChannelTypeFeatures this_obj_conv;
39095 this_obj_conv.inner = (void*)(this_obj & (~1));
39096 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39097 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39098 ChannelTypeFeatures_free(this_obj_conv);
39101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
39102 LDKInitFeatures ret_var = InitFeatures_empty();
39103 int64_t ret_ref = 0;
39104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39107 ret_ref = (uintptr_t)ret_var.inner;
39108 if (ret_var.is_owned) {
39114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
39115 LDKInitFeatures ret_var = InitFeatures_known();
39116 int64_t ret_ref = 0;
39117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39120 ret_ref = (uintptr_t)ret_var.inner;
39121 if (ret_var.is_owned) {
39127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39128 LDKInitFeatures this_arg_conv;
39129 this_arg_conv.inner = (void*)(this_arg & (~1));
39130 this_arg_conv.is_owned = false;
39131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39132 jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
39136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
39137 LDKNodeFeatures ret_var = NodeFeatures_empty();
39138 int64_t ret_ref = 0;
39139 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39140 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39141 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39142 ret_ref = (uintptr_t)ret_var.inner;
39143 if (ret_var.is_owned) {
39149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
39150 LDKNodeFeatures ret_var = NodeFeatures_known();
39151 int64_t ret_ref = 0;
39152 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39153 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39154 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39155 ret_ref = (uintptr_t)ret_var.inner;
39156 if (ret_var.is_owned) {
39162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39163 LDKNodeFeatures this_arg_conv;
39164 this_arg_conv.inner = (void*)(this_arg & (~1));
39165 this_arg_conv.is_owned = false;
39166 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39167 jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
39171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
39172 LDKChannelFeatures ret_var = ChannelFeatures_empty();
39173 int64_t ret_ref = 0;
39174 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39175 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39177 ret_ref = (uintptr_t)ret_var.inner;
39178 if (ret_var.is_owned) {
39184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
39185 LDKChannelFeatures ret_var = ChannelFeatures_known();
39186 int64_t ret_ref = 0;
39187 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39188 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39190 ret_ref = (uintptr_t)ret_var.inner;
39191 if (ret_var.is_owned) {
39197 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39198 LDKChannelFeatures this_arg_conv;
39199 this_arg_conv.inner = (void*)(this_arg & (~1));
39200 this_arg_conv.is_owned = false;
39201 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39202 jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
39206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
39207 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
39208 int64_t ret_ref = 0;
39209 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39210 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39211 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39212 ret_ref = (uintptr_t)ret_var.inner;
39213 if (ret_var.is_owned) {
39219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
39220 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
39221 int64_t ret_ref = 0;
39222 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39223 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39224 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39225 ret_ref = (uintptr_t)ret_var.inner;
39226 if (ret_var.is_owned) {
39232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39233 LDKInvoiceFeatures this_arg_conv;
39234 this_arg_conv.inner = (void*)(this_arg & (~1));
39235 this_arg_conv.is_owned = false;
39236 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39237 jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
39241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
39242 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
39243 int64_t ret_ref = 0;
39244 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39245 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39246 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39247 ret_ref = (uintptr_t)ret_var.inner;
39248 if (ret_var.is_owned) {
39254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
39255 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
39256 int64_t ret_ref = 0;
39257 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39258 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39259 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39260 ret_ref = (uintptr_t)ret_var.inner;
39261 if (ret_var.is_owned) {
39267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
39268 LDKChannelTypeFeatures this_arg_conv;
39269 this_arg_conv.inner = (void*)(this_arg & (~1));
39270 this_arg_conv.is_owned = false;
39271 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39272 jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
39276 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39277 LDKInitFeatures obj_conv;
39278 obj_conv.inner = (void*)(obj & (~1));
39279 obj_conv.is_owned = false;
39280 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39281 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
39282 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39283 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39284 CVec_u8Z_free(ret_var);
39288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39289 LDKu8slice ser_ref;
39290 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39291 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39292 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
39293 *ret_conv = InitFeatures_read(ser_ref);
39294 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39295 return (int64_t)ret_conv;
39298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39299 LDKChannelFeatures obj_conv;
39300 obj_conv.inner = (void*)(obj & (~1));
39301 obj_conv.is_owned = false;
39302 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39303 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
39304 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39305 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39306 CVec_u8Z_free(ret_var);
39310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39311 LDKu8slice ser_ref;
39312 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39313 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39314 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
39315 *ret_conv = ChannelFeatures_read(ser_ref);
39316 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39317 return (int64_t)ret_conv;
39320 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39321 LDKNodeFeatures obj_conv;
39322 obj_conv.inner = (void*)(obj & (~1));
39323 obj_conv.is_owned = false;
39324 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39325 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
39326 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39327 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39328 CVec_u8Z_free(ret_var);
39332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39333 LDKu8slice ser_ref;
39334 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39335 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39336 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
39337 *ret_conv = NodeFeatures_read(ser_ref);
39338 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39339 return (int64_t)ret_conv;
39342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39343 LDKInvoiceFeatures obj_conv;
39344 obj_conv.inner = (void*)(obj & (~1));
39345 obj_conv.is_owned = false;
39346 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39347 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
39348 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39349 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39350 CVec_u8Z_free(ret_var);
39354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39355 LDKu8slice ser_ref;
39356 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39357 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39358 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
39359 *ret_conv = InvoiceFeatures_read(ser_ref);
39360 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39361 return (int64_t)ret_conv;
39364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
39365 LDKChannelTypeFeatures obj_conv;
39366 obj_conv.inner = (void*)(obj & (~1));
39367 obj_conv.is_owned = false;
39368 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39369 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
39370 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39371 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39372 CVec_u8Z_free(ret_var);
39376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39377 LDKu8slice ser_ref;
39378 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39379 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39380 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
39381 *ret_conv = ChannelTypeFeatures_read(ser_ref);
39382 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39383 return (int64_t)ret_conv;
39386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39387 LDKShutdownScript this_obj_conv;
39388 this_obj_conv.inner = (void*)(this_obj & (~1));
39389 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39391 ShutdownScript_free(this_obj_conv);
39394 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
39395 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
39396 int64_t ret_ref = 0;
39397 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39398 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39400 ret_ref = (uintptr_t)ret_var.inner;
39401 if (ret_var.is_owned) {
39406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39407 LDKShutdownScript arg_conv;
39408 arg_conv.inner = (void*)(arg & (~1));
39409 arg_conv.is_owned = false;
39410 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39411 int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
39415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39416 LDKShutdownScript orig_conv;
39417 orig_conv.inner = (void*)(orig & (~1));
39418 orig_conv.is_owned = false;
39419 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39420 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
39421 int64_t ret_ref = 0;
39422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39425 ret_ref = (uintptr_t)ret_var.inner;
39426 if (ret_var.is_owned) {
39432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39433 LDKInvalidShutdownScript this_obj_conv;
39434 this_obj_conv.inner = (void*)(this_obj & (~1));
39435 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39437 InvalidShutdownScript_free(this_obj_conv);
39440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
39441 LDKInvalidShutdownScript this_ptr_conv;
39442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39443 this_ptr_conv.is_owned = false;
39444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39445 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
39446 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39447 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
39452 LDKInvalidShutdownScript this_ptr_conv;
39453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39454 this_ptr_conv.is_owned = false;
39455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39456 LDKCVec_u8Z val_ref;
39457 val_ref.datalen = (*env)->GetArrayLength(env, val);
39458 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39459 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
39460 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
39463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
39464 LDKCVec_u8Z script_arg_ref;
39465 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
39466 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39467 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
39468 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
39469 int64_t ret_ref = 0;
39470 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39471 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39472 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39473 ret_ref = (uintptr_t)ret_var.inner;
39474 if (ret_var.is_owned) {
39480 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
39481 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
39482 int64_t ret_ref = 0;
39483 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39484 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39485 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39486 ret_ref = (uintptr_t)ret_var.inner;
39487 if (ret_var.is_owned) {
39492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39493 LDKInvalidShutdownScript arg_conv;
39494 arg_conv.inner = (void*)(arg & (~1));
39495 arg_conv.is_owned = false;
39496 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39497 int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
39501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39502 LDKInvalidShutdownScript orig_conv;
39503 orig_conv.inner = (void*)(orig & (~1));
39504 orig_conv.is_owned = false;
39505 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39506 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
39507 int64_t ret_ref = 0;
39508 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39509 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39510 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39511 ret_ref = (uintptr_t)ret_var.inner;
39512 if (ret_var.is_owned) {
39518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
39519 LDKShutdownScript obj_conv;
39520 obj_conv.inner = (void*)(obj & (~1));
39521 obj_conv.is_owned = false;
39522 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39523 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
39524 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39525 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39526 CVec_u8Z_free(ret_var);
39530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39531 LDKu8slice ser_ref;
39532 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39533 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39534 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
39535 *ret_conv = ShutdownScript_read(ser_ref);
39536 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39537 return (int64_t)ret_conv;
39540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
39541 unsigned char pubkey_hash_arr[20];
39542 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
39543 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
39544 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
39545 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
39546 int64_t ret_ref = 0;
39547 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39548 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39550 ret_ref = (uintptr_t)ret_var.inner;
39551 if (ret_var.is_owned) {
39557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
39558 unsigned char script_hash_arr[32];
39559 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
39560 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
39561 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
39562 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
39563 int64_t ret_ref = 0;
39564 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39565 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39567 ret_ref = (uintptr_t)ret_var.inner;
39568 if (ret_var.is_owned) {
39574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
39575 LDKu8slice program_ref;
39576 program_ref.datalen = (*env)->GetArrayLength(env, program);
39577 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
39578 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
39579 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
39580 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
39581 return (int64_t)ret_conv;
39584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
39585 LDKShutdownScript this_arg_conv;
39586 this_arg_conv.inner = (void*)(this_arg & (~1));
39587 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
39588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39589 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
39590 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
39591 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39592 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39593 CVec_u8Z_free(ret_var);
39597 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
39598 LDKShutdownScript this_arg_conv;
39599 this_arg_conv.inner = (void*)(this_arg & (~1));
39600 this_arg_conv.is_owned = false;
39601 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39602 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39603 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
39607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
39608 LDKShutdownScript this_arg_conv;
39609 this_arg_conv.inner = (void*)(this_arg & (~1));
39610 this_arg_conv.is_owned = false;
39611 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39612 LDKInitFeatures features_conv;
39613 features_conv.inner = (void*)(features & (~1));
39614 features_conv.is_owned = false;
39615 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39616 jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
39620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39621 if ((this_ptr & 1) != 0) return;
39622 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39623 CHECK_ACCESS(this_ptr_ptr);
39624 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
39625 FREE((void*)this_ptr);
39626 CustomMessageReader_free(this_ptr_conv);
39629 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
39630 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39631 *ret_ret = Type_clone(arg);
39632 return (int64_t)ret_ret;
39634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39635 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
39636 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
39637 LDKType* arg_conv = (LDKType*)arg_ptr;
39638 int64_t ret_conv = Type_clone_ptr(arg_conv);
39642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39643 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
39644 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
39645 LDKType* orig_conv = (LDKType*)orig_ptr;
39646 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39647 *ret_ret = Type_clone(orig_conv);
39648 return (int64_t)ret_ret;
39651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39652 if ((this_ptr & 1) != 0) return;
39653 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39654 CHECK_ACCESS(this_ptr_ptr);
39655 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
39656 FREE((void*)this_ptr);
39657 Type_free(this_ptr_conv);
39660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39661 LDKNodeId this_obj_conv;
39662 this_obj_conv.inner = (void*)(this_obj & (~1));
39663 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39665 NodeId_free(this_obj_conv);
39668 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
39669 LDKNodeId ret_var = NodeId_clone(arg);
39670 int64_t ret_ref = 0;
39671 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39672 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39674 ret_ref = (uintptr_t)ret_var.inner;
39675 if (ret_var.is_owned) {
39680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39681 LDKNodeId arg_conv;
39682 arg_conv.inner = (void*)(arg & (~1));
39683 arg_conv.is_owned = false;
39684 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39685 int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
39689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39690 LDKNodeId orig_conv;
39691 orig_conv.inner = (void*)(orig & (~1));
39692 orig_conv.is_owned = false;
39693 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39694 LDKNodeId ret_var = NodeId_clone(&orig_conv);
39695 int64_t ret_ref = 0;
39696 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39697 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39698 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39699 ret_ref = (uintptr_t)ret_var.inner;
39700 if (ret_var.is_owned) {
39706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
39707 LDKPublicKey pubkey_ref;
39708 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
39709 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
39710 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
39711 int64_t ret_ref = 0;
39712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39715 ret_ref = (uintptr_t)ret_var.inner;
39716 if (ret_var.is_owned) {
39722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
39723 LDKNodeId this_arg_conv;
39724 this_arg_conv.inner = (void*)(this_arg & (~1));
39725 this_arg_conv.is_owned = false;
39726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39727 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
39728 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39729 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
39735 o_conv.inner = (void*)(o & (~1));
39736 o_conv.is_owned = false;
39737 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39738 int64_t ret_conv = NodeId_hash(&o_conv);
39742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
39743 LDKNodeId obj_conv;
39744 obj_conv.inner = (void*)(obj & (~1));
39745 obj_conv.is_owned = false;
39746 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39747 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
39748 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39749 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39750 CVec_u8Z_free(ret_var);
39754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39755 LDKu8slice ser_ref;
39756 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39757 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39758 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
39759 *ret_conv = NodeId_read(ser_ref);
39760 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39761 return (int64_t)ret_conv;
39764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39765 LDKNetworkGraph this_obj_conv;
39766 this_obj_conv.inner = (void*)(this_obj & (~1));
39767 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39769 NetworkGraph_free(this_obj_conv);
39772 static inline uintptr_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
39773 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
39774 int64_t ret_ref = 0;
39775 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39776 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39778 ret_ref = (uintptr_t)ret_var.inner;
39779 if (ret_var.is_owned) {
39784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39785 LDKNetworkGraph arg_conv;
39786 arg_conv.inner = (void*)(arg & (~1));
39787 arg_conv.is_owned = false;
39788 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39789 int64_t ret_conv = NetworkGraph_clone_ptr(&arg_conv);
39793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39794 LDKNetworkGraph orig_conv;
39795 orig_conv.inner = (void*)(orig & (~1));
39796 orig_conv.is_owned = false;
39797 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39798 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
39799 int64_t ret_ref = 0;
39800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39803 ret_ref = (uintptr_t)ret_var.inner;
39804 if (ret_var.is_owned) {
39810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39811 LDKReadOnlyNetworkGraph this_obj_conv;
39812 this_obj_conv.inner = (void*)(this_obj & (~1));
39813 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39815 ReadOnlyNetworkGraph_free(this_obj_conv);
39818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39819 if ((this_ptr & 1) != 0) return;
39820 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39821 CHECK_ACCESS(this_ptr_ptr);
39822 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
39823 FREE((void*)this_ptr);
39824 NetworkUpdate_free(this_ptr_conv);
39827 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
39828 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39829 *ret_copy = NetworkUpdate_clone(arg);
39830 int64_t ret_ref = (uintptr_t)ret_copy;
39833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39834 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
39835 int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
39839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39840 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
39841 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39842 *ret_copy = NetworkUpdate_clone(orig_conv);
39843 int64_t ret_ref = (uintptr_t)ret_copy;
39847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
39848 LDKChannelUpdate msg_conv;
39849 msg_conv.inner = (void*)(msg & (~1));
39850 msg_conv.is_owned = (msg & 1) || (msg == 0);
39851 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39852 msg_conv = ChannelUpdate_clone(&msg_conv);
39853 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39854 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
39855 int64_t ret_ref = (uintptr_t)ret_copy;
39859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
39860 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39861 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
39862 int64_t ret_ref = (uintptr_t)ret_copy;
39866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
39867 LDKPublicKey node_id_ref;
39868 CHECK((*env)->GetArrayLength(env, node_id) == 33);
39869 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
39870 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39871 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
39872 int64_t ret_ref = (uintptr_t)ret_copy;
39876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
39877 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
39878 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
39879 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39880 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39881 CVec_u8Z_free(ret_var);
39885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39886 LDKu8slice ser_ref;
39887 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39888 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39889 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
39890 *ret_conv = NetworkUpdate_read(ser_ref);
39891 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39892 return (int64_t)ret_conv;
39895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
39896 LDKNetGraphMsgHandler this_arg_conv;
39897 this_arg_conv.inner = (void*)(this_arg & (~1));
39898 this_arg_conv.is_owned = false;
39899 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39900 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
39901 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
39902 return (int64_t)ret_ret;
39905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39906 LDKNetGraphMsgHandler this_obj_conv;
39907 this_obj_conv.inner = (void*)(this_obj & (~1));
39908 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39910 NetGraphMsgHandler_free(this_obj_conv);
39913 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) {
39914 LDKNetworkGraph network_graph_conv;
39915 network_graph_conv.inner = (void*)(network_graph & (~1));
39916 network_graph_conv.is_owned = false;
39917 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
39918 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39919 CHECK_ACCESS(chain_access_ptr);
39920 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39921 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39922 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39923 // Manually implement clone for Java trait instances
39924 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39925 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39926 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39929 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
39930 CHECK_ACCESS(logger_ptr);
39931 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39932 if (logger_conv.free == LDKLogger_JCalls_free) {
39933 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39934 LDKLogger_JCalls_cloned(&logger_conv);
39936 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
39937 int64_t ret_ref = 0;
39938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39941 ret_ref = (uintptr_t)ret_var.inner;
39942 if (ret_var.is_owned) {
39948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
39949 LDKNetGraphMsgHandler this_arg_conv;
39950 this_arg_conv.inner = (void*)(this_arg & (~1));
39951 this_arg_conv.is_owned = false;
39952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39953 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39954 CHECK_ACCESS(chain_access_ptr);
39955 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39956 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39957 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39958 // Manually implement clone for Java trait instances
39959 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39960 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39961 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39964 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
39967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
39968 LDKNetGraphMsgHandler this_arg_conv;
39969 this_arg_conv.inner = (void*)(this_arg & (~1));
39970 this_arg_conv.is_owned = false;
39971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39972 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
39973 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
39974 return (int64_t)ret_ret;
39977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
39978 LDKNetGraphMsgHandler this_arg_conv;
39979 this_arg_conv.inner = (void*)(this_arg & (~1));
39980 this_arg_conv.is_owned = false;
39981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39982 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
39983 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
39984 return (int64_t)ret_ret;
39987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39988 LDKChannelUpdateInfo this_obj_conv;
39989 this_obj_conv.inner = (void*)(this_obj & (~1));
39990 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39992 ChannelUpdateInfo_free(this_obj_conv);
39995 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
39996 LDKChannelUpdateInfo this_ptr_conv;
39997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39998 this_ptr_conv.is_owned = false;
39999 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40000 int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
40004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40005 LDKChannelUpdateInfo this_ptr_conv;
40006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40007 this_ptr_conv.is_owned = false;
40008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40009 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
40012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
40013 LDKChannelUpdateInfo this_ptr_conv;
40014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40015 this_ptr_conv.is_owned = false;
40016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40017 jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
40021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
40022 LDKChannelUpdateInfo this_ptr_conv;
40023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40024 this_ptr_conv.is_owned = false;
40025 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40026 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
40029 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
40030 LDKChannelUpdateInfo this_ptr_conv;
40031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40032 this_ptr_conv.is_owned = false;
40033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40034 int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
40038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
40039 LDKChannelUpdateInfo this_ptr_conv;
40040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40041 this_ptr_conv.is_owned = false;
40042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40043 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
40046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40047 LDKChannelUpdateInfo this_ptr_conv;
40048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40049 this_ptr_conv.is_owned = false;
40050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40051 int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
40055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40056 LDKChannelUpdateInfo this_ptr_conv;
40057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40058 this_ptr_conv.is_owned = false;
40059 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40060 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
40063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40064 LDKChannelUpdateInfo this_ptr_conv;
40065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40066 this_ptr_conv.is_owned = false;
40067 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40068 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40069 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
40070 int64_t ret_ref = (uintptr_t)ret_copy;
40074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40075 LDKChannelUpdateInfo this_ptr_conv;
40076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40077 this_ptr_conv.is_owned = false;
40078 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40079 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
40080 CHECK_ACCESS(val_ptr);
40081 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40082 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
40083 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
40086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
40087 LDKChannelUpdateInfo this_ptr_conv;
40088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40089 this_ptr_conv.is_owned = false;
40090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40091 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
40092 int64_t ret_ref = 0;
40093 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40094 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40095 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40096 ret_ref = (uintptr_t)ret_var.inner;
40097 if (ret_var.is_owned) {
40103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40104 LDKChannelUpdateInfo this_ptr_conv;
40105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40106 this_ptr_conv.is_owned = false;
40107 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40108 LDKRoutingFees val_conv;
40109 val_conv.inner = (void*)(val & (~1));
40110 val_conv.is_owned = (val & 1) || (val == 0);
40111 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40112 val_conv = RoutingFees_clone(&val_conv);
40113 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
40116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
40117 LDKChannelUpdateInfo this_ptr_conv;
40118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40119 this_ptr_conv.is_owned = false;
40120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40121 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
40122 int64_t ret_ref = 0;
40123 if ((uintptr_t)ret_var.inner > 4096) {
40124 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40125 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40127 ret_ref = (uintptr_t)ret_var.inner;
40128 if (ret_var.is_owned) {
40135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40136 LDKChannelUpdateInfo this_ptr_conv;
40137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40138 this_ptr_conv.is_owned = false;
40139 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40140 LDKChannelUpdate val_conv;
40141 val_conv.inner = (void*)(val & (~1));
40142 val_conv.is_owned = (val & 1) || (val == 0);
40143 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40144 val_conv = ChannelUpdate_clone(&val_conv);
40145 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
40148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_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) {
40149 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
40150 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
40151 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
40152 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
40153 LDKRoutingFees fees_arg_conv;
40154 fees_arg_conv.inner = (void*)(fees_arg & (~1));
40155 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
40156 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
40157 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
40158 LDKChannelUpdate last_update_message_arg_conv;
40159 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
40160 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
40161 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
40162 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
40163 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_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);
40164 int64_t ret_ref = 0;
40165 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40166 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40168 ret_ref = (uintptr_t)ret_var.inner;
40169 if (ret_var.is_owned) {
40175 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
40176 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
40177 int64_t ret_ref = 0;
40178 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40179 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40180 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40181 ret_ref = (uintptr_t)ret_var.inner;
40182 if (ret_var.is_owned) {
40187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40188 LDKChannelUpdateInfo arg_conv;
40189 arg_conv.inner = (void*)(arg & (~1));
40190 arg_conv.is_owned = false;
40191 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40192 int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
40196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40197 LDKChannelUpdateInfo orig_conv;
40198 orig_conv.inner = (void*)(orig & (~1));
40199 orig_conv.is_owned = false;
40200 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40201 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
40202 int64_t ret_ref = 0;
40203 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40204 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40205 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40206 ret_ref = (uintptr_t)ret_var.inner;
40207 if (ret_var.is_owned) {
40213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
40214 LDKChannelUpdateInfo obj_conv;
40215 obj_conv.inner = (void*)(obj & (~1));
40216 obj_conv.is_owned = false;
40217 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40218 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
40219 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40220 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40221 CVec_u8Z_free(ret_var);
40225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40226 LDKu8slice ser_ref;
40227 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40228 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40229 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
40230 *ret_conv = ChannelUpdateInfo_read(ser_ref);
40231 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40232 return (int64_t)ret_conv;
40235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40236 LDKChannelInfo this_obj_conv;
40237 this_obj_conv.inner = (void*)(this_obj & (~1));
40238 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40240 ChannelInfo_free(this_obj_conv);
40243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
40244 LDKChannelInfo this_ptr_conv;
40245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40246 this_ptr_conv.is_owned = false;
40247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40248 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
40249 int64_t ret_ref = 0;
40250 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40251 CHECK((((uintptr_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 = (uintptr_t)ret_var.inner;
40254 if (ret_var.is_owned) {
40260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40261 LDKChannelInfo this_ptr_conv;
40262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40263 this_ptr_conv.is_owned = false;
40264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40265 LDKChannelFeatures val_conv;
40266 val_conv.inner = (void*)(val & (~1));
40267 val_conv.is_owned = (val & 1) || (val == 0);
40268 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40269 val_conv = ChannelFeatures_clone(&val_conv);
40270 ChannelInfo_set_features(&this_ptr_conv, val_conv);
40273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
40274 LDKChannelInfo this_ptr_conv;
40275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40276 this_ptr_conv.is_owned = false;
40277 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40278 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
40279 int64_t ret_ref = 0;
40280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40283 ret_ref = (uintptr_t)ret_var.inner;
40284 if (ret_var.is_owned) {
40290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40291 LDKChannelInfo this_ptr_conv;
40292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40293 this_ptr_conv.is_owned = false;
40294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40295 LDKNodeId val_conv;
40296 val_conv.inner = (void*)(val & (~1));
40297 val_conv.is_owned = (val & 1) || (val == 0);
40298 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40299 val_conv = NodeId_clone(&val_conv);
40300 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
40303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
40304 LDKChannelInfo this_ptr_conv;
40305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40306 this_ptr_conv.is_owned = false;
40307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40308 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
40309 int64_t ret_ref = 0;
40310 if ((uintptr_t)ret_var.inner > 4096) {
40311 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40312 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40314 ret_ref = (uintptr_t)ret_var.inner;
40315 if (ret_var.is_owned) {
40322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40323 LDKChannelInfo this_ptr_conv;
40324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40325 this_ptr_conv.is_owned = false;
40326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40327 LDKChannelUpdateInfo val_conv;
40328 val_conv.inner = (void*)(val & (~1));
40329 val_conv.is_owned = (val & 1) || (val == 0);
40330 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40331 val_conv = ChannelUpdateInfo_clone(&val_conv);
40332 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
40335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
40336 LDKChannelInfo this_ptr_conv;
40337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40338 this_ptr_conv.is_owned = false;
40339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40340 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
40341 int64_t ret_ref = 0;
40342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40345 ret_ref = (uintptr_t)ret_var.inner;
40346 if (ret_var.is_owned) {
40352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40353 LDKChannelInfo this_ptr_conv;
40354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40355 this_ptr_conv.is_owned = false;
40356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40357 LDKNodeId val_conv;
40358 val_conv.inner = (void*)(val & (~1));
40359 val_conv.is_owned = (val & 1) || (val == 0);
40360 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40361 val_conv = NodeId_clone(&val_conv);
40362 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
40365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
40366 LDKChannelInfo this_ptr_conv;
40367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40368 this_ptr_conv.is_owned = false;
40369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40370 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
40371 int64_t ret_ref = 0;
40372 if ((uintptr_t)ret_var.inner > 4096) {
40373 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40374 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40375 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40376 ret_ref = (uintptr_t)ret_var.inner;
40377 if (ret_var.is_owned) {
40384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40385 LDKChannelInfo this_ptr_conv;
40386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40387 this_ptr_conv.is_owned = false;
40388 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40389 LDKChannelUpdateInfo val_conv;
40390 val_conv.inner = (void*)(val & (~1));
40391 val_conv.is_owned = (val & 1) || (val == 0);
40392 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40393 val_conv = ChannelUpdateInfo_clone(&val_conv);
40394 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
40397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
40398 LDKChannelInfo this_ptr_conv;
40399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40400 this_ptr_conv.is_owned = false;
40401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40402 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
40403 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
40404 int64_t ret_ref = (uintptr_t)ret_copy;
40408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40409 LDKChannelInfo this_ptr_conv;
40410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40411 this_ptr_conv.is_owned = false;
40412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40413 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
40414 CHECK_ACCESS(val_ptr);
40415 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
40416 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
40417 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
40420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
40421 LDKChannelInfo this_ptr_conv;
40422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40423 this_ptr_conv.is_owned = false;
40424 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40425 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
40426 int64_t ret_ref = 0;
40427 if ((uintptr_t)ret_var.inner > 4096) {
40428 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40429 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40431 ret_ref = (uintptr_t)ret_var.inner;
40432 if (ret_var.is_owned) {
40439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40440 LDKChannelInfo this_ptr_conv;
40441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40442 this_ptr_conv.is_owned = false;
40443 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40444 LDKChannelAnnouncement val_conv;
40445 val_conv.inner = (void*)(val & (~1));
40446 val_conv.is_owned = (val & 1) || (val == 0);
40447 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40448 val_conv = ChannelAnnouncement_clone(&val_conv);
40449 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
40452 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
40453 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
40454 int64_t ret_ref = 0;
40455 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40456 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40457 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40458 ret_ref = (uintptr_t)ret_var.inner;
40459 if (ret_var.is_owned) {
40464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40465 LDKChannelInfo arg_conv;
40466 arg_conv.inner = (void*)(arg & (~1));
40467 arg_conv.is_owned = false;
40468 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40469 int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
40473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40474 LDKChannelInfo orig_conv;
40475 orig_conv.inner = (void*)(orig & (~1));
40476 orig_conv.is_owned = false;
40477 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40478 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
40479 int64_t ret_ref = 0;
40480 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40481 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40483 ret_ref = (uintptr_t)ret_var.inner;
40484 if (ret_var.is_owned) {
40490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
40491 LDKChannelInfo obj_conv;
40492 obj_conv.inner = (void*)(obj & (~1));
40493 obj_conv.is_owned = false;
40494 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40495 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
40496 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40497 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40498 CVec_u8Z_free(ret_var);
40502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40503 LDKu8slice ser_ref;
40504 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40505 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40506 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
40507 *ret_conv = ChannelInfo_read(ser_ref);
40508 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40509 return (int64_t)ret_conv;
40512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40513 LDKDirectedChannelInfo this_obj_conv;
40514 this_obj_conv.inner = (void*)(this_obj & (~1));
40515 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40517 DirectedChannelInfo_free(this_obj_conv);
40520 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
40521 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
40522 int64_t ret_ref = 0;
40523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40526 ret_ref = (uintptr_t)ret_var.inner;
40527 if (ret_var.is_owned) {
40532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40533 LDKDirectedChannelInfo arg_conv;
40534 arg_conv.inner = (void*)(arg & (~1));
40535 arg_conv.is_owned = false;
40536 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40537 int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
40541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40542 LDKDirectedChannelInfo orig_conv;
40543 orig_conv.inner = (void*)(orig & (~1));
40544 orig_conv.is_owned = false;
40545 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40546 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
40547 int64_t ret_ref = 0;
40548 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40549 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40551 ret_ref = (uintptr_t)ret_var.inner;
40552 if (ret_var.is_owned) {
40558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
40559 LDKDirectedChannelInfo this_arg_conv;
40560 this_arg_conv.inner = (void*)(this_arg & (~1));
40561 this_arg_conv.is_owned = false;
40562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40563 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
40564 int64_t ret_ref = 0;
40565 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40566 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40567 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40568 ret_ref = (uintptr_t)ret_var.inner;
40569 if (ret_var.is_owned) {
40575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
40576 LDKDirectedChannelInfo this_arg_conv;
40577 this_arg_conv.inner = (void*)(this_arg & (~1));
40578 this_arg_conv.is_owned = false;
40579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40580 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
40581 int64_t ret_ref = 0;
40582 if ((uintptr_t)ret_var.inner > 4096) {
40583 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40584 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40586 ret_ref = (uintptr_t)ret_var.inner;
40587 if (ret_var.is_owned) {
40594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
40595 LDKDirectedChannelInfo this_arg_conv;
40596 this_arg_conv.inner = (void*)(this_arg & (~1));
40597 this_arg_conv.is_owned = false;
40598 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40599 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40600 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
40601 int64_t ret_ref = (uintptr_t)ret_copy;
40605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40606 if ((this_ptr & 1) != 0) return;
40607 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40608 CHECK_ACCESS(this_ptr_ptr);
40609 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
40610 FREE((void*)this_ptr);
40611 EffectiveCapacity_free(this_ptr_conv);
40614 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
40615 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40616 *ret_copy = EffectiveCapacity_clone(arg);
40617 int64_t ret_ref = (uintptr_t)ret_copy;
40620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40621 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
40622 int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
40626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40627 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
40628 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40629 *ret_copy = EffectiveCapacity_clone(orig_conv);
40630 int64_t ret_ref = (uintptr_t)ret_copy;
40634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
40635 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40636 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
40637 int64_t ret_ref = (uintptr_t)ret_copy;
40641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
40642 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40643 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
40644 int64_t ret_ref = (uintptr_t)ret_copy;
40648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat) {
40649 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40650 *ret_copy = EffectiveCapacity_total(capacity_msat);
40651 int64_t ret_ref = (uintptr_t)ret_copy;
40655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
40656 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40657 *ret_copy = EffectiveCapacity_infinite();
40658 int64_t ret_ref = (uintptr_t)ret_copy;
40662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
40663 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40664 *ret_copy = EffectiveCapacity_unknown();
40665 int64_t ret_ref = (uintptr_t)ret_copy;
40669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
40670 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
40671 int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
40675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40676 LDKRoutingFees this_obj_conv;
40677 this_obj_conv.inner = (void*)(this_obj & (~1));
40678 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40680 RoutingFees_free(this_obj_conv);
40683 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40684 LDKRoutingFees this_ptr_conv;
40685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40686 this_ptr_conv.is_owned = false;
40687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40688 int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
40692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40693 LDKRoutingFees this_ptr_conv;
40694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40695 this_ptr_conv.is_owned = false;
40696 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40697 RoutingFees_set_base_msat(&this_ptr_conv, val);
40700 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
40701 LDKRoutingFees this_ptr_conv;
40702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40703 this_ptr_conv.is_owned = false;
40704 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40705 int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
40709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40710 LDKRoutingFees this_ptr_conv;
40711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40712 this_ptr_conv.is_owned = false;
40713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40714 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
40717 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) {
40718 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
40719 int64_t ret_ref = 0;
40720 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40721 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40722 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40723 ret_ref = (uintptr_t)ret_var.inner;
40724 if (ret_var.is_owned) {
40730 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40731 LDKRoutingFees a_conv;
40732 a_conv.inner = (void*)(a & (~1));
40733 a_conv.is_owned = false;
40734 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40735 LDKRoutingFees b_conv;
40736 b_conv.inner = (void*)(b & (~1));
40737 b_conv.is_owned = false;
40738 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40739 jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
40743 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
40744 LDKRoutingFees ret_var = RoutingFees_clone(arg);
40745 int64_t ret_ref = 0;
40746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40749 ret_ref = (uintptr_t)ret_var.inner;
40750 if (ret_var.is_owned) {
40755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40756 LDKRoutingFees arg_conv;
40757 arg_conv.inner = (void*)(arg & (~1));
40758 arg_conv.is_owned = false;
40759 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40760 int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
40764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40765 LDKRoutingFees orig_conv;
40766 orig_conv.inner = (void*)(orig & (~1));
40767 orig_conv.is_owned = false;
40768 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40769 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
40770 int64_t ret_ref = 0;
40771 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40772 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40773 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40774 ret_ref = (uintptr_t)ret_var.inner;
40775 if (ret_var.is_owned) {
40781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
40782 LDKRoutingFees o_conv;
40783 o_conv.inner = (void*)(o & (~1));
40784 o_conv.is_owned = false;
40785 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40786 int64_t ret_conv = RoutingFees_hash(&o_conv);
40790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
40791 LDKRoutingFees obj_conv;
40792 obj_conv.inner = (void*)(obj & (~1));
40793 obj_conv.is_owned = false;
40794 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40795 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
40796 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40797 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40798 CVec_u8Z_free(ret_var);
40802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40803 LDKu8slice ser_ref;
40804 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40805 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40806 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
40807 *ret_conv = RoutingFees_read(ser_ref);
40808 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40809 return (int64_t)ret_conv;
40812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40813 LDKNodeAnnouncementInfo this_obj_conv;
40814 this_obj_conv.inner = (void*)(this_obj & (~1));
40815 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40816 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40817 NodeAnnouncementInfo_free(this_obj_conv);
40820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
40821 LDKNodeAnnouncementInfo this_ptr_conv;
40822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40823 this_ptr_conv.is_owned = false;
40824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40825 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
40826 int64_t ret_ref = 0;
40827 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40828 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40830 ret_ref = (uintptr_t)ret_var.inner;
40831 if (ret_var.is_owned) {
40837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40838 LDKNodeAnnouncementInfo this_ptr_conv;
40839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40840 this_ptr_conv.is_owned = false;
40841 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40842 LDKNodeFeatures val_conv;
40843 val_conv.inner = (void*)(val & (~1));
40844 val_conv.is_owned = (val & 1) || (val == 0);
40845 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40846 val_conv = NodeFeatures_clone(&val_conv);
40847 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
40850 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
40851 LDKNodeAnnouncementInfo this_ptr_conv;
40852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40853 this_ptr_conv.is_owned = false;
40854 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40855 int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
40859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40860 LDKNodeAnnouncementInfo this_ptr_conv;
40861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40862 this_ptr_conv.is_owned = false;
40863 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40864 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
40867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
40868 LDKNodeAnnouncementInfo this_ptr_conv;
40869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40870 this_ptr_conv.is_owned = false;
40871 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40872 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
40873 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
40877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40878 LDKNodeAnnouncementInfo this_ptr_conv;
40879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40880 this_ptr_conv.is_owned = false;
40881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40882 LDKThreeBytes val_ref;
40883 CHECK((*env)->GetArrayLength(env, val) == 3);
40884 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
40885 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
40888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
40889 LDKNodeAnnouncementInfo this_ptr_conv;
40890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40891 this_ptr_conv.is_owned = false;
40892 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40893 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40894 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
40898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40899 LDKNodeAnnouncementInfo this_ptr_conv;
40900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40901 this_ptr_conv.is_owned = false;
40902 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40903 LDKThirtyTwoBytes val_ref;
40904 CHECK((*env)->GetArrayLength(env, val) == 32);
40905 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40906 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
40909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40910 LDKNodeAnnouncementInfo this_ptr_conv;
40911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40912 this_ptr_conv.is_owned = false;
40913 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40914 LDKCVec_NetAddressZ val_constr;
40915 val_constr.datalen = (*env)->GetArrayLength(env, val);
40916 if (val_constr.datalen > 0)
40917 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40919 val_constr.data = NULL;
40920 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40921 for (size_t m = 0; m < val_constr.datalen; m++) {
40922 int64_t val_conv_12 = val_vals[m];
40923 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
40924 CHECK_ACCESS(val_conv_12_ptr);
40925 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
40926 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
40927 val_constr.data[m] = val_conv_12_conv;
40929 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40930 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
40933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
40934 LDKNodeAnnouncementInfo this_ptr_conv;
40935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40936 this_ptr_conv.is_owned = false;
40937 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40938 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
40939 int64_t ret_ref = 0;
40940 if ((uintptr_t)ret_var.inner > 4096) {
40941 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40942 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40943 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40944 ret_ref = (uintptr_t)ret_var.inner;
40945 if (ret_var.is_owned) {
40952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40953 LDKNodeAnnouncementInfo this_ptr_conv;
40954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40955 this_ptr_conv.is_owned = false;
40956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40957 LDKNodeAnnouncement val_conv;
40958 val_conv.inner = (void*)(val & (~1));
40959 val_conv.is_owned = (val & 1) || (val == 0);
40960 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40961 val_conv = NodeAnnouncement_clone(&val_conv);
40962 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
40965 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) {
40966 LDKNodeFeatures features_arg_conv;
40967 features_arg_conv.inner = (void*)(features_arg & (~1));
40968 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
40969 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40970 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
40971 LDKThreeBytes rgb_arg_ref;
40972 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
40973 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
40974 LDKThirtyTwoBytes alias_arg_ref;
40975 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
40976 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
40977 LDKCVec_NetAddressZ addresses_arg_constr;
40978 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
40979 if (addresses_arg_constr.datalen > 0)
40980 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40982 addresses_arg_constr.data = NULL;
40983 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
40984 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
40985 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
40986 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
40987 CHECK_ACCESS(addresses_arg_conv_12_ptr);
40988 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
40989 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
40991 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
40992 LDKNodeAnnouncement announcement_message_arg_conv;
40993 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
40994 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
40995 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
40996 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
40997 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
40998 int64_t ret_ref = 0;
40999 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41000 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41002 ret_ref = (uintptr_t)ret_var.inner;
41003 if (ret_var.is_owned) {
41009 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
41010 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
41011 int64_t ret_ref = 0;
41012 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41013 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41015 ret_ref = (uintptr_t)ret_var.inner;
41016 if (ret_var.is_owned) {
41021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41022 LDKNodeAnnouncementInfo arg_conv;
41023 arg_conv.inner = (void*)(arg & (~1));
41024 arg_conv.is_owned = false;
41025 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41026 int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
41030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41031 LDKNodeAnnouncementInfo orig_conv;
41032 orig_conv.inner = (void*)(orig & (~1));
41033 orig_conv.is_owned = false;
41034 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41035 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
41036 int64_t ret_ref = 0;
41037 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41038 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41040 ret_ref = (uintptr_t)ret_var.inner;
41041 if (ret_var.is_owned) {
41047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41048 LDKNodeAnnouncementInfo obj_conv;
41049 obj_conv.inner = (void*)(obj & (~1));
41050 obj_conv.is_owned = false;
41051 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41052 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
41053 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41054 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41055 CVec_u8Z_free(ret_var);
41059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41060 LDKu8slice ser_ref;
41061 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41062 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41063 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
41064 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
41065 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41066 return (int64_t)ret_conv;
41069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41070 LDKNodeInfo this_obj_conv;
41071 this_obj_conv.inner = (void*)(this_obj & (~1));
41072 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41074 NodeInfo_free(this_obj_conv);
41077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
41078 LDKNodeInfo this_ptr_conv;
41079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41080 this_ptr_conv.is_owned = false;
41081 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41082 LDKCVec_u64Z val_constr;
41083 val_constr.datalen = (*env)->GetArrayLength(env, val);
41084 if (val_constr.datalen > 0)
41085 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41087 val_constr.data = NULL;
41088 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
41089 for (size_t g = 0; g < val_constr.datalen; g++) {
41090 int64_t val_conv_6 = val_vals[g];
41091 val_constr.data[g] = val_conv_6;
41093 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
41094 NodeInfo_set_channels(&this_ptr_conv, val_constr);
41097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
41098 LDKNodeInfo this_ptr_conv;
41099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41100 this_ptr_conv.is_owned = false;
41101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41102 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
41103 int64_t ret_ref = 0;
41104 if ((uintptr_t)ret_var.inner > 4096) {
41105 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41106 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41107 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41108 ret_ref = (uintptr_t)ret_var.inner;
41109 if (ret_var.is_owned) {
41116 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) {
41117 LDKNodeInfo this_ptr_conv;
41118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41119 this_ptr_conv.is_owned = false;
41120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41121 LDKRoutingFees val_conv;
41122 val_conv.inner = (void*)(val & (~1));
41123 val_conv.is_owned = (val & 1) || (val == 0);
41124 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41125 val_conv = RoutingFees_clone(&val_conv);
41126 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
41129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
41130 LDKNodeInfo this_ptr_conv;
41131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41132 this_ptr_conv.is_owned = false;
41133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41134 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
41135 int64_t ret_ref = 0;
41136 if ((uintptr_t)ret_var.inner > 4096) {
41137 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41138 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41139 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41140 ret_ref = (uintptr_t)ret_var.inner;
41141 if (ret_var.is_owned) {
41148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41149 LDKNodeInfo this_ptr_conv;
41150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41151 this_ptr_conv.is_owned = false;
41152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41153 LDKNodeAnnouncementInfo val_conv;
41154 val_conv.inner = (void*)(val & (~1));
41155 val_conv.is_owned = (val & 1) || (val == 0);
41156 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41157 val_conv = NodeAnnouncementInfo_clone(&val_conv);
41158 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
41161 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) {
41162 LDKCVec_u64Z channels_arg_constr;
41163 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
41164 if (channels_arg_constr.datalen > 0)
41165 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41167 channels_arg_constr.data = NULL;
41168 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
41169 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
41170 int64_t channels_arg_conv_6 = channels_arg_vals[g];
41171 channels_arg_constr.data[g] = channels_arg_conv_6;
41173 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
41174 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
41175 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
41176 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
41177 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
41178 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
41179 LDKNodeAnnouncementInfo announcement_info_arg_conv;
41180 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
41181 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
41182 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
41183 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
41184 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
41185 int64_t ret_ref = 0;
41186 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41187 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41188 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41189 ret_ref = (uintptr_t)ret_var.inner;
41190 if (ret_var.is_owned) {
41196 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
41197 LDKNodeInfo ret_var = NodeInfo_clone(arg);
41198 int64_t ret_ref = 0;
41199 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41200 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41201 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41202 ret_ref = (uintptr_t)ret_var.inner;
41203 if (ret_var.is_owned) {
41208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41209 LDKNodeInfo arg_conv;
41210 arg_conv.inner = (void*)(arg & (~1));
41211 arg_conv.is_owned = false;
41212 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41213 int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
41217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41218 LDKNodeInfo orig_conv;
41219 orig_conv.inner = (void*)(orig & (~1));
41220 orig_conv.is_owned = false;
41221 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41222 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
41223 int64_t ret_ref = 0;
41224 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41225 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41226 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41227 ret_ref = (uintptr_t)ret_var.inner;
41228 if (ret_var.is_owned) {
41234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
41235 LDKNodeInfo obj_conv;
41236 obj_conv.inner = (void*)(obj & (~1));
41237 obj_conv.is_owned = false;
41238 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41239 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
41240 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41241 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41242 CVec_u8Z_free(ret_var);
41246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41247 LDKu8slice ser_ref;
41248 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41249 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41250 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
41251 *ret_conv = NodeInfo_read(ser_ref);
41252 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41253 return (int64_t)ret_conv;
41256 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
41257 LDKNetworkGraph obj_conv;
41258 obj_conv.inner = (void*)(obj & (~1));
41259 obj_conv.is_owned = false;
41260 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41261 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
41262 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41263 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41264 CVec_u8Z_free(ret_var);
41268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41269 LDKu8slice ser_ref;
41270 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41271 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41272 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
41273 *ret_conv = NetworkGraph_read(ser_ref);
41274 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41275 return (int64_t)ret_conv;
41278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
41279 LDKThirtyTwoBytes genesis_hash_ref;
41280 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
41281 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
41282 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
41283 int64_t ret_ref = 0;
41284 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41285 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41287 ret_ref = (uintptr_t)ret_var.inner;
41288 if (ret_var.is_owned) {
41294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
41295 LDKNetworkGraph this_arg_conv;
41296 this_arg_conv.inner = (void*)(this_arg & (~1));
41297 this_arg_conv.is_owned = false;
41298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41299 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
41300 int64_t ret_ref = 0;
41301 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41302 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41304 ret_ref = (uintptr_t)ret_var.inner;
41305 if (ret_var.is_owned) {
41311 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) {
41312 LDKNetworkGraph this_arg_conv;
41313 this_arg_conv.inner = (void*)(this_arg & (~1));
41314 this_arg_conv.is_owned = false;
41315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41316 LDKNodeAnnouncement msg_conv;
41317 msg_conv.inner = (void*)(msg & (~1));
41318 msg_conv.is_owned = false;
41319 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41320 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41321 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
41322 return (int64_t)ret_conv;
41325 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) {
41326 LDKNetworkGraph this_arg_conv;
41327 this_arg_conv.inner = (void*)(this_arg & (~1));
41328 this_arg_conv.is_owned = false;
41329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41330 LDKUnsignedNodeAnnouncement msg_conv;
41331 msg_conv.inner = (void*)(msg & (~1));
41332 msg_conv.is_owned = false;
41333 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41334 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41335 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
41336 return (int64_t)ret_conv;
41339 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) {
41340 LDKNetworkGraph this_arg_conv;
41341 this_arg_conv.inner = (void*)(this_arg & (~1));
41342 this_arg_conv.is_owned = false;
41343 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41344 LDKChannelAnnouncement msg_conv;
41345 msg_conv.inner = (void*)(msg & (~1));
41346 msg_conv.is_owned = false;
41347 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41348 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
41349 CHECK_ACCESS(chain_access_ptr);
41350 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41351 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41352 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41353 // Manually implement clone for Java trait instances
41354 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41355 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41356 LDKAccess_JCalls_cloned(&chain_access_conv.some);
41359 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41360 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
41361 return (int64_t)ret_conv;
41364 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) {
41365 LDKNetworkGraph this_arg_conv;
41366 this_arg_conv.inner = (void*)(this_arg & (~1));
41367 this_arg_conv.is_owned = false;
41368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41369 LDKUnsignedChannelAnnouncement msg_conv;
41370 msg_conv.inner = (void*)(msg & (~1));
41371 msg_conv.is_owned = false;
41372 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41373 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
41374 CHECK_ACCESS(chain_access_ptr);
41375 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41376 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41377 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41378 // Manually implement clone for Java trait instances
41379 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41380 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41381 LDKAccess_JCalls_cloned(&chain_access_conv.some);
41384 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41385 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
41386 return (int64_t)ret_conv;
41389 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) {
41390 LDKNetworkGraph this_arg_conv;
41391 this_arg_conv.inner = (void*)(this_arg & (~1));
41392 this_arg_conv.is_owned = false;
41393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41394 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
41397 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) {
41398 LDKNetworkGraph this_arg_conv;
41399 this_arg_conv.inner = (void*)(this_arg & (~1));
41400 this_arg_conv.is_owned = false;
41401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41402 LDKPublicKey _node_id_ref;
41403 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
41404 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
41405 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
41408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
41409 LDKNetworkGraph this_arg_conv;
41410 this_arg_conv.inner = (void*)(this_arg & (~1));
41411 this_arg_conv.is_owned = false;
41412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41413 NetworkGraph_remove_stale_channels(&this_arg_conv);
41416 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) {
41417 LDKNetworkGraph this_arg_conv;
41418 this_arg_conv.inner = (void*)(this_arg & (~1));
41419 this_arg_conv.is_owned = false;
41420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41421 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
41424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
41425 LDKNetworkGraph this_arg_conv;
41426 this_arg_conv.inner = (void*)(this_arg & (~1));
41427 this_arg_conv.is_owned = false;
41428 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41429 LDKChannelUpdate msg_conv;
41430 msg_conv.inner = (void*)(msg & (~1));
41431 msg_conv.is_owned = false;
41432 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41433 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41434 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
41435 return (int64_t)ret_conv;
41438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
41439 LDKNetworkGraph this_arg_conv;
41440 this_arg_conv.inner = (void*)(this_arg & (~1));
41441 this_arg_conv.is_owned = false;
41442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41443 LDKUnsignedChannelUpdate msg_conv;
41444 msg_conv.inner = (void*)(msg & (~1));
41445 msg_conv.is_owned = false;
41446 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41447 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41448 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
41449 return (int64_t)ret_conv;
41452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
41453 LDKReadOnlyNetworkGraph this_arg_conv;
41454 this_arg_conv.inner = (void*)(this_arg & (~1));
41455 this_arg_conv.is_owned = false;
41456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41457 LDKPublicKey pubkey_ref;
41458 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
41459 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
41460 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
41461 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
41462 int64_t ret_ref = (uintptr_t)ret_copy;
41466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41467 LDKRouteHop this_obj_conv;
41468 this_obj_conv.inner = (void*)(this_obj & (~1));
41469 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41470 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41471 RouteHop_free(this_obj_conv);
41474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41475 LDKRouteHop this_ptr_conv;
41476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41477 this_ptr_conv.is_owned = false;
41478 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41479 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41480 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
41484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41485 LDKRouteHop this_ptr_conv;
41486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41487 this_ptr_conv.is_owned = false;
41488 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41489 LDKPublicKey val_ref;
41490 CHECK((*env)->GetArrayLength(env, val) == 33);
41491 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41492 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
41495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41496 LDKRouteHop this_ptr_conv;
41497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41498 this_ptr_conv.is_owned = false;
41499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41500 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
41501 int64_t ret_ref = 0;
41502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41505 ret_ref = (uintptr_t)ret_var.inner;
41506 if (ret_var.is_owned) {
41512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41513 LDKRouteHop this_ptr_conv;
41514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41515 this_ptr_conv.is_owned = false;
41516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41517 LDKNodeFeatures val_conv;
41518 val_conv.inner = (void*)(val & (~1));
41519 val_conv.is_owned = (val & 1) || (val == 0);
41520 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41521 val_conv = NodeFeatures_clone(&val_conv);
41522 RouteHop_set_node_features(&this_ptr_conv, val_conv);
41525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41526 LDKRouteHop this_ptr_conv;
41527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41528 this_ptr_conv.is_owned = false;
41529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41530 int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
41534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41535 LDKRouteHop this_ptr_conv;
41536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41537 this_ptr_conv.is_owned = false;
41538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41539 RouteHop_set_short_channel_id(&this_ptr_conv, val);
41542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41543 LDKRouteHop this_ptr_conv;
41544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41545 this_ptr_conv.is_owned = false;
41546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41547 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
41548 int64_t ret_ref = 0;
41549 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41550 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41551 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41552 ret_ref = (uintptr_t)ret_var.inner;
41553 if (ret_var.is_owned) {
41559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41560 LDKRouteHop this_ptr_conv;
41561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41562 this_ptr_conv.is_owned = false;
41563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41564 LDKChannelFeatures val_conv;
41565 val_conv.inner = (void*)(val & (~1));
41566 val_conv.is_owned = (val & 1) || (val == 0);
41567 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41568 val_conv = ChannelFeatures_clone(&val_conv);
41569 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
41572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41573 LDKRouteHop this_ptr_conv;
41574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41575 this_ptr_conv.is_owned = false;
41576 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41577 int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
41581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41582 LDKRouteHop this_ptr_conv;
41583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41584 this_ptr_conv.is_owned = false;
41585 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41586 RouteHop_set_fee_msat(&this_ptr_conv, val);
41589 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41590 LDKRouteHop this_ptr_conv;
41591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41592 this_ptr_conv.is_owned = false;
41593 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41594 int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
41598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41599 LDKRouteHop this_ptr_conv;
41600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41601 this_ptr_conv.is_owned = false;
41602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41603 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
41606 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) {
41607 LDKPublicKey pubkey_arg_ref;
41608 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
41609 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
41610 LDKNodeFeatures node_features_arg_conv;
41611 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
41612 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
41613 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
41614 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
41615 LDKChannelFeatures channel_features_arg_conv;
41616 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
41617 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
41618 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
41619 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
41620 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);
41621 int64_t ret_ref = 0;
41622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41625 ret_ref = (uintptr_t)ret_var.inner;
41626 if (ret_var.is_owned) {
41632 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
41633 LDKRouteHop ret_var = RouteHop_clone(arg);
41634 int64_t ret_ref = 0;
41635 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41636 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41637 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41638 ret_ref = (uintptr_t)ret_var.inner;
41639 if (ret_var.is_owned) {
41644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41645 LDKRouteHop arg_conv;
41646 arg_conv.inner = (void*)(arg & (~1));
41647 arg_conv.is_owned = false;
41648 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41649 int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
41653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41654 LDKRouteHop orig_conv;
41655 orig_conv.inner = (void*)(orig & (~1));
41656 orig_conv.is_owned = false;
41657 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41658 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
41659 int64_t ret_ref = 0;
41660 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41661 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41662 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41663 ret_ref = (uintptr_t)ret_var.inner;
41664 if (ret_var.is_owned) {
41670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
41671 LDKRouteHop o_conv;
41672 o_conv.inner = (void*)(o & (~1));
41673 o_conv.is_owned = false;
41674 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41675 int64_t ret_conv = RouteHop_hash(&o_conv);
41679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41680 LDKRouteHop a_conv;
41681 a_conv.inner = (void*)(a & (~1));
41682 a_conv.is_owned = false;
41683 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41684 LDKRouteHop b_conv;
41685 b_conv.inner = (void*)(b & (~1));
41686 b_conv.is_owned = false;
41687 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41688 jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
41692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
41693 LDKRouteHop obj_conv;
41694 obj_conv.inner = (void*)(obj & (~1));
41695 obj_conv.is_owned = false;
41696 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41697 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
41698 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41699 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41700 CVec_u8Z_free(ret_var);
41704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41705 LDKu8slice ser_ref;
41706 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41707 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41708 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
41709 *ret_conv = RouteHop_read(ser_ref);
41710 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41711 return (int64_t)ret_conv;
41714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41715 LDKRoute this_obj_conv;
41716 this_obj_conv.inner = (void*)(this_obj & (~1));
41717 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41719 Route_free(this_obj_conv);
41722 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
41723 LDKRoute this_ptr_conv;
41724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41725 this_ptr_conv.is_owned = false;
41726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41727 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
41728 jobjectArray ret_arr = NULL;
41729 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
41731 for (size_t m = 0; m < ret_var.datalen; m++) {
41732 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
41733 int64_tArray ret_conv_12_arr = NULL;
41734 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
41735 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
41736 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
41737 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
41738 int64_t ret_conv_12_conv_10_ref = 0;
41739 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41740 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41741 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
41742 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
41743 if (ret_conv_12_conv_10_var.is_owned) {
41744 ret_conv_12_conv_10_ref |= 1;
41746 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
41748 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
41749 FREE(ret_conv_12_var.data);
41750 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
41753 FREE(ret_var.data);
41757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
41758 LDKRoute this_ptr_conv;
41759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41760 this_ptr_conv.is_owned = false;
41761 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41762 LDKCVec_CVec_RouteHopZZ val_constr;
41763 val_constr.datalen = (*env)->GetArrayLength(env, val);
41764 if (val_constr.datalen > 0)
41765 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41767 val_constr.data = NULL;
41768 for (size_t m = 0; m < val_constr.datalen; m++) {
41769 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
41770 LDKCVec_RouteHopZ val_conv_12_constr;
41771 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
41772 if (val_conv_12_constr.datalen > 0)
41773 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41775 val_conv_12_constr.data = NULL;
41776 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
41777 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
41778 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
41779 LDKRouteHop val_conv_12_conv_10_conv;
41780 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
41781 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
41782 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
41783 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
41784 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
41786 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
41787 val_constr.data[m] = val_conv_12_constr;
41789 Route_set_paths(&this_ptr_conv, val_constr);
41792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
41793 LDKRoute this_ptr_conv;
41794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41795 this_ptr_conv.is_owned = false;
41796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41797 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
41798 int64_t ret_ref = 0;
41799 if ((uintptr_t)ret_var.inner > 4096) {
41800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41803 ret_ref = (uintptr_t)ret_var.inner;
41804 if (ret_var.is_owned) {
41811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41812 LDKRoute this_ptr_conv;
41813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41814 this_ptr_conv.is_owned = false;
41815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41816 LDKPaymentParameters val_conv;
41817 val_conv.inner = (void*)(val & (~1));
41818 val_conv.is_owned = (val & 1) || (val == 0);
41819 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41820 val_conv = PaymentParameters_clone(&val_conv);
41821 Route_set_payment_params(&this_ptr_conv, val_conv);
41824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
41825 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
41826 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
41827 if (paths_arg_constr.datalen > 0)
41828 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41830 paths_arg_constr.data = NULL;
41831 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
41832 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
41833 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
41834 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
41835 if (paths_arg_conv_12_constr.datalen > 0)
41836 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41838 paths_arg_conv_12_constr.data = NULL;
41839 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
41840 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
41841 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
41842 LDKRouteHop paths_arg_conv_12_conv_10_conv;
41843 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
41844 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
41845 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
41846 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
41847 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
41849 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
41850 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
41852 LDKPaymentParameters payment_params_arg_conv;
41853 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
41854 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
41855 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41856 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41857 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
41858 int64_t ret_ref = 0;
41859 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41860 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41862 ret_ref = (uintptr_t)ret_var.inner;
41863 if (ret_var.is_owned) {
41869 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
41870 LDKRoute ret_var = Route_clone(arg);
41871 int64_t ret_ref = 0;
41872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41875 ret_ref = (uintptr_t)ret_var.inner;
41876 if (ret_var.is_owned) {
41881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41883 arg_conv.inner = (void*)(arg & (~1));
41884 arg_conv.is_owned = false;
41885 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41886 int64_t ret_conv = Route_clone_ptr(&arg_conv);
41890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41891 LDKRoute orig_conv;
41892 orig_conv.inner = (void*)(orig & (~1));
41893 orig_conv.is_owned = false;
41894 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41895 LDKRoute ret_var = Route_clone(&orig_conv);
41896 int64_t ret_ref = 0;
41897 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41898 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41900 ret_ref = (uintptr_t)ret_var.inner;
41901 if (ret_var.is_owned) {
41907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
41909 o_conv.inner = (void*)(o & (~1));
41910 o_conv.is_owned = false;
41911 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41912 int64_t ret_conv = Route_hash(&o_conv);
41916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41918 a_conv.inner = (void*)(a & (~1));
41919 a_conv.is_owned = false;
41920 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41922 b_conv.inner = (void*)(b & (~1));
41923 b_conv.is_owned = false;
41924 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41925 jboolean ret_conv = Route_eq(&a_conv, &b_conv);
41929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
41930 LDKRoute this_arg_conv;
41931 this_arg_conv.inner = (void*)(this_arg & (~1));
41932 this_arg_conv.is_owned = false;
41933 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41934 int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
41938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
41939 LDKRoute this_arg_conv;
41940 this_arg_conv.inner = (void*)(this_arg & (~1));
41941 this_arg_conv.is_owned = false;
41942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41943 int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
41947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
41949 obj_conv.inner = (void*)(obj & (~1));
41950 obj_conv.is_owned = false;
41951 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41952 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
41953 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41954 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41955 CVec_u8Z_free(ret_var);
41959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41960 LDKu8slice ser_ref;
41961 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41962 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41963 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
41964 *ret_conv = Route_read(ser_ref);
41965 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41966 return (int64_t)ret_conv;
41969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41970 LDKRouteParameters this_obj_conv;
41971 this_obj_conv.inner = (void*)(this_obj & (~1));
41972 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41974 RouteParameters_free(this_obj_conv);
41977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
41978 LDKRouteParameters this_ptr_conv;
41979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41980 this_ptr_conv.is_owned = false;
41981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41982 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
41983 int64_t ret_ref = 0;
41984 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41985 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41986 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41987 ret_ref = (uintptr_t)ret_var.inner;
41988 if (ret_var.is_owned) {
41994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41995 LDKRouteParameters this_ptr_conv;
41996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41997 this_ptr_conv.is_owned = false;
41998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41999 LDKPaymentParameters val_conv;
42000 val_conv.inner = (void*)(val & (~1));
42001 val_conv.is_owned = (val & 1) || (val == 0);
42002 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42003 val_conv = PaymentParameters_clone(&val_conv);
42004 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
42007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42008 LDKRouteParameters this_ptr_conv;
42009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42010 this_ptr_conv.is_owned = false;
42011 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42012 int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
42016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42017 LDKRouteParameters this_ptr_conv;
42018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42019 this_ptr_conv.is_owned = false;
42020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42021 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
42024 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
42025 LDKRouteParameters this_ptr_conv;
42026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42027 this_ptr_conv.is_owned = false;
42028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42029 int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
42033 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) {
42034 LDKRouteParameters this_ptr_conv;
42035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42036 this_ptr_conv.is_owned = false;
42037 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42038 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
42041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1new(JNIEnv *env, jclass clz, int64_t payment_params_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
42042 LDKPaymentParameters payment_params_arg_conv;
42043 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
42044 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
42045 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
42046 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
42047 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
42048 int64_t ret_ref = 0;
42049 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42050 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42051 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42052 ret_ref = (uintptr_t)ret_var.inner;
42053 if (ret_var.is_owned) {
42059 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
42060 LDKRouteParameters ret_var = RouteParameters_clone(arg);
42061 int64_t ret_ref = 0;
42062 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42063 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42064 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42065 ret_ref = (uintptr_t)ret_var.inner;
42066 if (ret_var.is_owned) {
42071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42072 LDKRouteParameters arg_conv;
42073 arg_conv.inner = (void*)(arg & (~1));
42074 arg_conv.is_owned = false;
42075 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42076 int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
42080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42081 LDKRouteParameters orig_conv;
42082 orig_conv.inner = (void*)(orig & (~1));
42083 orig_conv.is_owned = false;
42084 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42085 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
42086 int64_t ret_ref = 0;
42087 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42088 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42089 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42090 ret_ref = (uintptr_t)ret_var.inner;
42091 if (ret_var.is_owned) {
42097 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
42098 LDKRouteParameters obj_conv;
42099 obj_conv.inner = (void*)(obj & (~1));
42100 obj_conv.is_owned = false;
42101 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42102 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
42103 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42104 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42105 CVec_u8Z_free(ret_var);
42109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42110 LDKu8slice ser_ref;
42111 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42112 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42113 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
42114 *ret_conv = RouteParameters_read(ser_ref);
42115 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42116 return (int64_t)ret_conv;
42119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42120 LDKPaymentParameters this_obj_conv;
42121 this_obj_conv.inner = (void*)(this_obj & (~1));
42122 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42124 PaymentParameters_free(this_obj_conv);
42127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42128 LDKPaymentParameters this_ptr_conv;
42129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42130 this_ptr_conv.is_owned = false;
42131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42132 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42133 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
42137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42138 LDKPaymentParameters this_ptr_conv;
42139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42140 this_ptr_conv.is_owned = false;
42141 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42142 LDKPublicKey val_ref;
42143 CHECK((*env)->GetArrayLength(env, val) == 33);
42144 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42145 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
42148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
42149 LDKPaymentParameters this_ptr_conv;
42150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42151 this_ptr_conv.is_owned = false;
42152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42153 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
42154 int64_t ret_ref = 0;
42155 if ((uintptr_t)ret_var.inner > 4096) {
42156 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42157 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42158 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42159 ret_ref = (uintptr_t)ret_var.inner;
42160 if (ret_var.is_owned) {
42167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42168 LDKPaymentParameters this_ptr_conv;
42169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42170 this_ptr_conv.is_owned = false;
42171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42172 LDKInvoiceFeatures val_conv;
42173 val_conv.inner = (void*)(val & (~1));
42174 val_conv.is_owned = (val & 1) || (val == 0);
42175 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42176 val_conv = InvoiceFeatures_clone(&val_conv);
42177 PaymentParameters_set_features(&this_ptr_conv, val_conv);
42180 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
42181 LDKPaymentParameters this_ptr_conv;
42182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42183 this_ptr_conv.is_owned = false;
42184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42185 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
42186 int64_tArray ret_arr = NULL;
42187 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42188 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42189 for (size_t l = 0; l < ret_var.datalen; l++) {
42190 LDKRouteHint ret_conv_11_var = ret_var.data[l];
42191 int64_t ret_conv_11_ref = 0;
42192 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42193 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42194 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
42195 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
42196 if (ret_conv_11_var.is_owned) {
42197 ret_conv_11_ref |= 1;
42199 ret_arr_ptr[l] = ret_conv_11_ref;
42201 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42202 FREE(ret_var.data);
42206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42207 LDKPaymentParameters this_ptr_conv;
42208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42209 this_ptr_conv.is_owned = false;
42210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42211 LDKCVec_RouteHintZ val_constr;
42212 val_constr.datalen = (*env)->GetArrayLength(env, val);
42213 if (val_constr.datalen > 0)
42214 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
42216 val_constr.data = NULL;
42217 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42218 for (size_t l = 0; l < val_constr.datalen; l++) {
42219 int64_t val_conv_11 = val_vals[l];
42220 LDKRouteHint val_conv_11_conv;
42221 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
42222 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
42223 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
42224 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
42225 val_constr.data[l] = val_conv_11_conv;
42227 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42228 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
42231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
42232 LDKPaymentParameters this_ptr_conv;
42233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42234 this_ptr_conv.is_owned = false;
42235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42236 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42237 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
42238 int64_t ret_ref = (uintptr_t)ret_copy;
42242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42243 LDKPaymentParameters this_ptr_conv;
42244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42245 this_ptr_conv.is_owned = false;
42246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42247 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42248 CHECK_ACCESS(val_ptr);
42249 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42250 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42251 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
42254 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
42255 LDKPaymentParameters this_ptr_conv;
42256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42257 this_ptr_conv.is_owned = false;
42258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42259 int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
42263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42264 LDKPaymentParameters this_ptr_conv;
42265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42266 this_ptr_conv.is_owned = false;
42267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42268 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
42271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1new(JNIEnv *env, jclass clz, int8_tArray payee_pubkey_arg, int64_t features_arg, int64_tArray route_hints_arg, int64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg) {
42272 LDKPublicKey payee_pubkey_arg_ref;
42273 CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
42274 (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
42275 LDKInvoiceFeatures features_arg_conv;
42276 features_arg_conv.inner = (void*)(features_arg & (~1));
42277 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
42278 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42279 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
42280 LDKCVec_RouteHintZ route_hints_arg_constr;
42281 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
42282 if (route_hints_arg_constr.datalen > 0)
42283 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
42285 route_hints_arg_constr.data = NULL;
42286 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
42287 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
42288 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
42289 LDKRouteHint route_hints_arg_conv_11_conv;
42290 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
42291 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
42292 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
42293 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
42294 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
42296 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
42297 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
42298 CHECK_ACCESS(expiry_time_arg_ptr);
42299 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
42300 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
42301 LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg);
42302 int64_t ret_ref = 0;
42303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42306 ret_ref = (uintptr_t)ret_var.inner;
42307 if (ret_var.is_owned) {
42313 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
42314 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
42315 int64_t ret_ref = 0;
42316 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42317 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42318 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42319 ret_ref = (uintptr_t)ret_var.inner;
42320 if (ret_var.is_owned) {
42325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42326 LDKPaymentParameters arg_conv;
42327 arg_conv.inner = (void*)(arg & (~1));
42328 arg_conv.is_owned = false;
42329 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42330 int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
42334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42335 LDKPaymentParameters orig_conv;
42336 orig_conv.inner = (void*)(orig & (~1));
42337 orig_conv.is_owned = false;
42338 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42339 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
42340 int64_t ret_ref = 0;
42341 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42342 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42343 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42344 ret_ref = (uintptr_t)ret_var.inner;
42345 if (ret_var.is_owned) {
42351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
42352 LDKPaymentParameters o_conv;
42353 o_conv.inner = (void*)(o & (~1));
42354 o_conv.is_owned = false;
42355 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42356 int64_t ret_conv = PaymentParameters_hash(&o_conv);
42360 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42361 LDKPaymentParameters a_conv;
42362 a_conv.inner = (void*)(a & (~1));
42363 a_conv.is_owned = false;
42364 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42365 LDKPaymentParameters b_conv;
42366 b_conv.inner = (void*)(b & (~1));
42367 b_conv.is_owned = false;
42368 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42369 jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
42373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
42374 LDKPaymentParameters obj_conv;
42375 obj_conv.inner = (void*)(obj & (~1));
42376 obj_conv.is_owned = false;
42377 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42378 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
42379 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42380 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42381 CVec_u8Z_free(ret_var);
42385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42386 LDKu8slice ser_ref;
42387 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42388 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42389 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
42390 *ret_conv = PaymentParameters_read(ser_ref);
42391 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42392 return (int64_t)ret_conv;
42395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
42396 LDKPublicKey payee_pubkey_ref;
42397 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
42398 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
42399 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
42400 int64_t ret_ref = 0;
42401 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42402 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42403 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42404 ret_ref = (uintptr_t)ret_var.inner;
42405 if (ret_var.is_owned) {
42411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
42412 LDKPublicKey payee_pubkey_ref;
42413 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
42414 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
42415 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
42416 int64_t ret_ref = 0;
42417 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42418 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42420 ret_ref = (uintptr_t)ret_var.inner;
42421 if (ret_var.is_owned) {
42427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42428 LDKRouteHint this_obj_conv;
42429 this_obj_conv.inner = (void*)(this_obj & (~1));
42430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42432 RouteHint_free(this_obj_conv);
42435 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
42436 LDKRouteHint this_ptr_conv;
42437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42438 this_ptr_conv.is_owned = false;
42439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42440 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
42441 int64_tArray ret_arr = NULL;
42442 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
42443 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
42444 for (size_t o = 0; o < ret_var.datalen; o++) {
42445 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
42446 int64_t ret_conv_14_ref = 0;
42447 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42448 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
42450 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
42451 if (ret_conv_14_var.is_owned) {
42452 ret_conv_14_ref |= 1;
42454 ret_arr_ptr[o] = ret_conv_14_ref;
42456 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
42457 FREE(ret_var.data);
42461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
42462 LDKRouteHint this_ptr_conv;
42463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42464 this_ptr_conv.is_owned = false;
42465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42466 LDKCVec_RouteHintHopZ val_constr;
42467 val_constr.datalen = (*env)->GetArrayLength(env, val);
42468 if (val_constr.datalen > 0)
42469 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
42471 val_constr.data = NULL;
42472 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
42473 for (size_t o = 0; o < val_constr.datalen; o++) {
42474 int64_t val_conv_14 = val_vals[o];
42475 LDKRouteHintHop val_conv_14_conv;
42476 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
42477 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
42478 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
42479 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
42480 val_constr.data[o] = val_conv_14_conv;
42482 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
42483 RouteHint_set_a(&this_ptr_conv, val_constr);
42486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
42487 LDKCVec_RouteHintHopZ a_arg_constr;
42488 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
42489 if (a_arg_constr.datalen > 0)
42490 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
42492 a_arg_constr.data = NULL;
42493 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
42494 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
42495 int64_t a_arg_conv_14 = a_arg_vals[o];
42496 LDKRouteHintHop a_arg_conv_14_conv;
42497 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
42498 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
42499 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
42500 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
42501 a_arg_constr.data[o] = a_arg_conv_14_conv;
42503 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
42504 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
42505 int64_t ret_ref = 0;
42506 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42507 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42508 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42509 ret_ref = (uintptr_t)ret_var.inner;
42510 if (ret_var.is_owned) {
42516 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
42517 LDKRouteHint ret_var = RouteHint_clone(arg);
42518 int64_t ret_ref = 0;
42519 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42520 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42521 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42522 ret_ref = (uintptr_t)ret_var.inner;
42523 if (ret_var.is_owned) {
42528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42529 LDKRouteHint arg_conv;
42530 arg_conv.inner = (void*)(arg & (~1));
42531 arg_conv.is_owned = false;
42532 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42533 int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
42537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42538 LDKRouteHint orig_conv;
42539 orig_conv.inner = (void*)(orig & (~1));
42540 orig_conv.is_owned = false;
42541 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42542 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
42543 int64_t ret_ref = 0;
42544 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42545 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42546 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42547 ret_ref = (uintptr_t)ret_var.inner;
42548 if (ret_var.is_owned) {
42554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
42555 LDKRouteHint o_conv;
42556 o_conv.inner = (void*)(o & (~1));
42557 o_conv.is_owned = false;
42558 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42559 int64_t ret_conv = RouteHint_hash(&o_conv);
42563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42564 LDKRouteHint a_conv;
42565 a_conv.inner = (void*)(a & (~1));
42566 a_conv.is_owned = false;
42567 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42568 LDKRouteHint b_conv;
42569 b_conv.inner = (void*)(b & (~1));
42570 b_conv.is_owned = false;
42571 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42572 jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
42576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
42577 LDKRouteHint obj_conv;
42578 obj_conv.inner = (void*)(obj & (~1));
42579 obj_conv.is_owned = false;
42580 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42581 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
42582 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42583 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42584 CVec_u8Z_free(ret_var);
42588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42589 LDKu8slice ser_ref;
42590 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42591 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42592 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
42593 *ret_conv = RouteHint_read(ser_ref);
42594 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42595 return (int64_t)ret_conv;
42598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42599 LDKRouteHintHop this_obj_conv;
42600 this_obj_conv.inner = (void*)(this_obj & (~1));
42601 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42602 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42603 RouteHintHop_free(this_obj_conv);
42606 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42607 LDKRouteHintHop this_ptr_conv;
42608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42609 this_ptr_conv.is_owned = false;
42610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42611 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42612 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
42616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42617 LDKRouteHintHop this_ptr_conv;
42618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42619 this_ptr_conv.is_owned = false;
42620 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42621 LDKPublicKey val_ref;
42622 CHECK((*env)->GetArrayLength(env, val) == 33);
42623 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42624 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
42627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42628 LDKRouteHintHop this_ptr_conv;
42629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42630 this_ptr_conv.is_owned = false;
42631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42632 int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
42636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42637 LDKRouteHintHop this_ptr_conv;
42638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42639 this_ptr_conv.is_owned = false;
42640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42641 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
42644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
42645 LDKRouteHintHop this_ptr_conv;
42646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42647 this_ptr_conv.is_owned = false;
42648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42649 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
42650 int64_t ret_ref = 0;
42651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42654 ret_ref = (uintptr_t)ret_var.inner;
42655 if (ret_var.is_owned) {
42661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42662 LDKRouteHintHop this_ptr_conv;
42663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42664 this_ptr_conv.is_owned = false;
42665 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42666 LDKRoutingFees val_conv;
42667 val_conv.inner = (void*)(val & (~1));
42668 val_conv.is_owned = (val & 1) || (val == 0);
42669 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42670 val_conv = RoutingFees_clone(&val_conv);
42671 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
42674 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
42675 LDKRouteHintHop this_ptr_conv;
42676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42677 this_ptr_conv.is_owned = false;
42678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42679 int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
42683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42684 LDKRouteHintHop this_ptr_conv;
42685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42686 this_ptr_conv.is_owned = false;
42687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42688 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
42691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42692 LDKRouteHintHop this_ptr_conv;
42693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42694 this_ptr_conv.is_owned = false;
42695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42696 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42697 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
42698 int64_t ret_ref = (uintptr_t)ret_copy;
42702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42703 LDKRouteHintHop this_ptr_conv;
42704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42705 this_ptr_conv.is_owned = false;
42706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42707 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42708 CHECK_ACCESS(val_ptr);
42709 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42710 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42711 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
42714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42715 LDKRouteHintHop this_ptr_conv;
42716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42717 this_ptr_conv.is_owned = false;
42718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42719 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42720 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
42721 int64_t ret_ref = (uintptr_t)ret_copy;
42725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42726 LDKRouteHintHop this_ptr_conv;
42727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42728 this_ptr_conv.is_owned = false;
42729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42730 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42731 CHECK_ACCESS(val_ptr);
42732 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42733 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42734 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
42737 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) {
42738 LDKPublicKey src_node_id_arg_ref;
42739 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
42740 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
42741 LDKRoutingFees fees_arg_conv;
42742 fees_arg_conv.inner = (void*)(fees_arg & (~1));
42743 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
42744 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
42745 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
42746 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
42747 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
42748 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
42749 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
42750 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
42751 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
42752 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
42753 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
42754 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);
42755 int64_t ret_ref = 0;
42756 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42757 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42758 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42759 ret_ref = (uintptr_t)ret_var.inner;
42760 if (ret_var.is_owned) {
42766 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
42767 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
42768 int64_t ret_ref = 0;
42769 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42770 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42771 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42772 ret_ref = (uintptr_t)ret_var.inner;
42773 if (ret_var.is_owned) {
42778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42779 LDKRouteHintHop arg_conv;
42780 arg_conv.inner = (void*)(arg & (~1));
42781 arg_conv.is_owned = false;
42782 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42783 int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
42787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42788 LDKRouteHintHop orig_conv;
42789 orig_conv.inner = (void*)(orig & (~1));
42790 orig_conv.is_owned = false;
42791 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42792 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
42793 int64_t ret_ref = 0;
42794 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42795 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42796 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42797 ret_ref = (uintptr_t)ret_var.inner;
42798 if (ret_var.is_owned) {
42804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
42805 LDKRouteHintHop o_conv;
42806 o_conv.inner = (void*)(o & (~1));
42807 o_conv.is_owned = false;
42808 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42809 int64_t ret_conv = RouteHintHop_hash(&o_conv);
42813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42814 LDKRouteHintHop a_conv;
42815 a_conv.inner = (void*)(a & (~1));
42816 a_conv.is_owned = false;
42817 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42818 LDKRouteHintHop b_conv;
42819 b_conv.inner = (void*)(b & (~1));
42820 b_conv.is_owned = false;
42821 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42822 jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
42826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
42827 LDKRouteHintHop obj_conv;
42828 obj_conv.inner = (void*)(obj & (~1));
42829 obj_conv.is_owned = false;
42830 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42831 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
42832 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42833 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42834 CVec_u8Z_free(ret_var);
42838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42839 LDKu8slice ser_ref;
42840 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42841 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42842 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
42843 *ret_conv = RouteHintHop_read(ser_ref);
42844 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42845 return (int64_t)ret_conv;
42848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer, int8_tArray random_seed_bytes) {
42849 LDKPublicKey our_node_pubkey_ref;
42850 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
42851 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
42852 LDKRouteParameters route_params_conv;
42853 route_params_conv.inner = (void*)(route_params & (~1));
42854 route_params_conv.is_owned = false;
42855 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42856 LDKNetworkGraph network_conv;
42857 network_conv.inner = (void*)(network & (~1));
42858 network_conv.is_owned = false;
42859 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
42860 LDKCVec_ChannelDetailsZ first_hops_constr;
42861 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
42862 if (first_hops != NULL) {
42863 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
42864 if (first_hops_constr.datalen > 0)
42865 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
42867 first_hops_constr.data = NULL;
42868 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
42869 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
42870 int64_t first_hops_conv_16 = first_hops_vals[q];
42871 LDKChannelDetails first_hops_conv_16_conv;
42872 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
42873 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
42874 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
42875 first_hops_constr.data[q] = first_hops_conv_16_conv;
42877 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
42878 first_hops_ptr = &first_hops_constr;
42880 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
42881 CHECK_ACCESS(logger_ptr);
42882 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42883 if (logger_conv.free == LDKLogger_JCalls_free) {
42884 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42885 LDKLogger_JCalls_cloned(&logger_conv);
42887 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
42888 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
42889 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
42890 unsigned char random_seed_bytes_arr[32];
42891 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
42892 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
42893 unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
42894 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
42895 *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref);
42896 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
42897 return (int64_t)ret_conv;
42900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42901 if ((this_ptr & 1) != 0) return;
42902 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42903 CHECK_ACCESS(this_ptr_ptr);
42904 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
42905 FREE((void*)this_ptr);
42906 Score_free(this_ptr_conv);
42909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42910 if ((this_ptr & 1) != 0) return;
42911 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42912 CHECK_ACCESS(this_ptr_ptr);
42913 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
42914 FREE((void*)this_ptr);
42915 LockableScore_free(this_ptr_conv);
42918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42919 LDKMultiThreadedLockableScore this_obj_conv;
42920 this_obj_conv.inner = (void*)(this_obj & (~1));
42921 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42922 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42923 MultiThreadedLockableScore_free(this_obj_conv);
42926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
42927 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
42928 CHECK_ACCESS(score_ptr);
42929 LDKScore score_conv = *(LDKScore*)(score_ptr);
42930 if (score_conv.free == LDKScore_JCalls_free) {
42931 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42932 LDKScore_JCalls_cloned(&score_conv);
42934 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
42935 int64_t ret_ref = 0;
42936 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42937 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42938 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42939 ret_ref = (uintptr_t)ret_var.inner;
42940 if (ret_var.is_owned) {
42946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42947 LDKFixedPenaltyScorer this_obj_conv;
42948 this_obj_conv.inner = (void*)(this_obj & (~1));
42949 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42951 FixedPenaltyScorer_free(this_obj_conv);
42954 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
42955 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
42956 int64_t ret_ref = 0;
42957 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42958 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42960 ret_ref = (uintptr_t)ret_var.inner;
42961 if (ret_var.is_owned) {
42966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42967 LDKFixedPenaltyScorer arg_conv;
42968 arg_conv.inner = (void*)(arg & (~1));
42969 arg_conv.is_owned = false;
42970 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42971 int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
42975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42976 LDKFixedPenaltyScorer orig_conv;
42977 orig_conv.inner = (void*)(orig & (~1));
42978 orig_conv.is_owned = false;
42979 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42980 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
42981 int64_t ret_ref = 0;
42982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42985 ret_ref = (uintptr_t)ret_var.inner;
42986 if (ret_var.is_owned) {
42992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
42993 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
42994 int64_t ret_ref = 0;
42995 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42996 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42998 ret_ref = (uintptr_t)ret_var.inner;
42999 if (ret_var.is_owned) {
43005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
43006 LDKFixedPenaltyScorer this_arg_conv;
43007 this_arg_conv.inner = (void*)(this_arg & (~1));
43008 this_arg_conv.is_owned = false;
43009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43010 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43011 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
43012 return (int64_t)ret_ret;
43015 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
43016 LDKFixedPenaltyScorer obj_conv;
43017 obj_conv.inner = (void*)(obj & (~1));
43018 obj_conv.is_owned = false;
43019 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43020 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
43021 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43022 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43023 CVec_u8Z_free(ret_var);
43027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
43028 LDKu8slice ser_ref;
43029 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43030 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43031 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
43032 *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
43033 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43034 return (int64_t)ret_conv;
43037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43038 LDKScorer this_obj_conv;
43039 this_obj_conv.inner = (void*)(this_obj & (~1));
43040 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43042 Scorer_free(this_obj_conv);
43045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43046 LDKScoringParameters this_obj_conv;
43047 this_obj_conv.inner = (void*)(this_obj & (~1));
43048 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43050 ScoringParameters_free(this_obj_conv);
43053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43054 LDKScoringParameters this_ptr_conv;
43055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43056 this_ptr_conv.is_owned = false;
43057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43058 int64_t ret_conv = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
43062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43063 LDKScoringParameters this_ptr_conv;
43064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43065 this_ptr_conv.is_owned = false;
43066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43067 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
43070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43071 LDKScoringParameters this_ptr_conv;
43072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43073 this_ptr_conv.is_owned = false;
43074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43075 int64_t ret_conv = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
43079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43080 LDKScoringParameters this_ptr_conv;
43081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43082 this_ptr_conv.is_owned = false;
43083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43084 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
43087 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
43088 LDKScoringParameters this_ptr_conv;
43089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43090 this_ptr_conv.is_owned = false;
43091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43092 int16_t ret_conv = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
43096 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) {
43097 LDKScoringParameters this_ptr_conv;
43098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43099 this_ptr_conv.is_owned = false;
43100 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43101 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
43104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
43105 LDKScoringParameters this_ptr_conv;
43106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43107 this_ptr_conv.is_owned = false;
43108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43109 int64_t ret_conv = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
43113 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) {
43114 LDKScoringParameters this_ptr_conv;
43115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43116 this_ptr_conv.is_owned = false;
43117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43118 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
43121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
43122 LDKScoringParameters this_ptr_conv;
43123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43124 this_ptr_conv.is_owned = false;
43125 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43126 int64_t ret_conv = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
43130 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) {
43131 LDKScoringParameters this_ptr_conv;
43132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43133 this_ptr_conv.is_owned = false;
43134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43135 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
43138 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) {
43139 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);
43140 int64_t ret_ref = 0;
43141 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43142 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43144 ret_ref = (uintptr_t)ret_var.inner;
43145 if (ret_var.is_owned) {
43151 static inline uintptr_t ScoringParameters_clone_ptr(LDKScoringParameters *NONNULL_PTR arg) {
43152 LDKScoringParameters ret_var = ScoringParameters_clone(arg);
43153 int64_t ret_ref = 0;
43154 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43155 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43156 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43157 ret_ref = (uintptr_t)ret_var.inner;
43158 if (ret_var.is_owned) {
43163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43164 LDKScoringParameters arg_conv;
43165 arg_conv.inner = (void*)(arg & (~1));
43166 arg_conv.is_owned = false;
43167 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43168 int64_t ret_conv = ScoringParameters_clone_ptr(&arg_conv);
43172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43173 LDKScoringParameters orig_conv;
43174 orig_conv.inner = (void*)(orig & (~1));
43175 orig_conv.is_owned = false;
43176 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43177 LDKScoringParameters ret_var = ScoringParameters_clone(&orig_conv);
43178 int64_t ret_ref = 0;
43179 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43180 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43181 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43182 ret_ref = (uintptr_t)ret_var.inner;
43183 if (ret_var.is_owned) {
43189 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
43190 LDKScoringParameters obj_conv;
43191 obj_conv.inner = (void*)(obj & (~1));
43192 obj_conv.is_owned = false;
43193 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43194 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
43195 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43196 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43197 CVec_u8Z_free(ret_var);
43201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43202 LDKu8slice ser_ref;
43203 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43204 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43205 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
43206 *ret_conv = ScoringParameters_read(ser_ref);
43207 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43208 return (int64_t)ret_conv;
43211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t params) {
43212 LDKScoringParameters params_conv;
43213 params_conv.inner = (void*)(params & (~1));
43214 params_conv.is_owned = (params & 1) || (params == 0);
43215 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
43216 params_conv = ScoringParameters_clone(¶ms_conv);
43217 LDKScorer ret_var = Scorer_new(params_conv);
43218 int64_t ret_ref = 0;
43219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43222 ret_ref = (uintptr_t)ret_var.inner;
43223 if (ret_var.is_owned) {
43229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) {
43230 LDKScorer ret_var = Scorer_default();
43231 int64_t ret_ref = 0;
43232 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43233 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43234 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43235 ret_ref = (uintptr_t)ret_var.inner;
43236 if (ret_var.is_owned) {
43242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1default(JNIEnv *env, jclass clz) {
43243 LDKScoringParameters ret_var = ScoringParameters_default();
43244 int64_t ret_ref = 0;
43245 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43246 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43247 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43248 ret_ref = (uintptr_t)ret_var.inner;
43249 if (ret_var.is_owned) {
43255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
43256 LDKScorer this_arg_conv;
43257 this_arg_conv.inner = (void*)(this_arg & (~1));
43258 this_arg_conv.is_owned = false;
43259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43260 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43261 *ret_ret = Scorer_as_Score(&this_arg_conv);
43262 return (int64_t)ret_ret;
43265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Scorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
43266 LDKScorer obj_conv;
43267 obj_conv.inner = (void*)(obj & (~1));
43268 obj_conv.is_owned = false;
43269 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43270 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
43271 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43272 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43273 CVec_u8Z_free(ret_var);
43277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43278 LDKu8slice ser_ref;
43279 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43280 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43281 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
43282 *ret_conv = Scorer_read(ser_ref);
43283 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43284 return (int64_t)ret_conv;
43287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43288 LDKProbabilisticScorer this_obj_conv;
43289 this_obj_conv.inner = (void*)(this_obj & (~1));
43290 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43291 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43292 ProbabilisticScorer_free(this_obj_conv);
43295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43296 LDKProbabilisticScoringParameters this_obj_conv;
43297 this_obj_conv.inner = (void*)(this_obj & (~1));
43298 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43300 ProbabilisticScoringParameters_free(this_obj_conv);
43303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43304 LDKProbabilisticScoringParameters this_ptr_conv;
43305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43306 this_ptr_conv.is_owned = false;
43307 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43308 int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
43312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43313 LDKProbabilisticScoringParameters this_ptr_conv;
43314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43315 this_ptr_conv.is_owned = false;
43316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43317 ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
43320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43321 LDKProbabilisticScoringParameters this_ptr_conv;
43322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43323 this_ptr_conv.is_owned = false;
43324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43325 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
43329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43330 LDKProbabilisticScoringParameters this_ptr_conv;
43331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43332 this_ptr_conv.is_owned = false;
43333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43334 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
43337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
43338 LDKProbabilisticScoringParameters this_ptr_conv;
43339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43340 this_ptr_conv.is_owned = false;
43341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43342 int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
43346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43347 LDKProbabilisticScoringParameters this_ptr_conv;
43348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43349 this_ptr_conv.is_owned = false;
43350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43351 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
43354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43355 LDKProbabilisticScoringParameters this_ptr_conv;
43356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43357 this_ptr_conv.is_owned = false;
43358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43359 int64_t ret_conv = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv);
43363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43364 LDKProbabilisticScoringParameters this_ptr_conv;
43365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43366 this_ptr_conv.is_owned = false;
43367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43368 ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val);
43371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg, int64_t amount_penalty_multiplier_msat_arg) {
43372 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(base_penalty_msat_arg, liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg, amount_penalty_multiplier_msat_arg);
43373 int64_t ret_ref = 0;
43374 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43375 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43376 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43377 ret_ref = (uintptr_t)ret_var.inner;
43378 if (ret_var.is_owned) {
43384 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
43385 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
43386 int64_t ret_ref = 0;
43387 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43388 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43389 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43390 ret_ref = (uintptr_t)ret_var.inner;
43391 if (ret_var.is_owned) {
43396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43397 LDKProbabilisticScoringParameters arg_conv;
43398 arg_conv.inner = (void*)(arg & (~1));
43399 arg_conv.is_owned = false;
43400 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43401 int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
43405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43406 LDKProbabilisticScoringParameters orig_conv;
43407 orig_conv.inner = (void*)(orig & (~1));
43408 orig_conv.is_owned = false;
43409 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43410 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
43411 int64_t ret_ref = 0;
43412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43415 ret_ref = (uintptr_t)ret_var.inner;
43416 if (ret_var.is_owned) {
43422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t params, int64_t network_graph) {
43423 LDKProbabilisticScoringParameters params_conv;
43424 params_conv.inner = (void*)(params & (~1));
43425 params_conv.is_owned = (params & 1) || (params == 0);
43426 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
43427 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
43428 LDKNetworkGraph network_graph_conv;
43429 network_graph_conv.inner = (void*)(network_graph & (~1));
43430 network_graph_conv.is_owned = false;
43431 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43432 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv);
43433 int64_t ret_ref = 0;
43434 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43435 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43437 ret_ref = (uintptr_t)ret_var.inner;
43438 if (ret_var.is_owned) {
43444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
43445 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
43446 int64_t ret_ref = 0;
43447 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43448 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43449 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43450 ret_ref = (uintptr_t)ret_var.inner;
43451 if (ret_var.is_owned) {
43457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
43458 LDKProbabilisticScorer this_arg_conv;
43459 this_arg_conv.inner = (void*)(this_arg & (~1));
43460 this_arg_conv.is_owned = false;
43461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43462 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43463 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
43464 return (int64_t)ret_ret;
43467 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
43468 LDKProbabilisticScorer obj_conv;
43469 obj_conv.inner = (void*)(obj & (~1));
43470 obj_conv.is_owned = false;
43471 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43472 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
43473 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43474 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43475 CVec_u8Z_free(ret_var);
43479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) {
43480 LDKu8slice ser_ref;
43481 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43482 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43483 LDKProbabilisticScoringParameters arg_a_conv;
43484 arg_a_conv.inner = (void*)(arg_a & (~1));
43485 arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0);
43486 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
43487 arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
43488 LDKNetworkGraph arg_b_conv;
43489 arg_b_conv.inner = (void*)(arg_b & (~1));
43490 arg_b_conv.is_owned = false;
43491 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
43492 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
43493 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv);
43494 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43495 return (int64_t)ret_conv;
43498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43499 LDKFilesystemPersister this_obj_conv;
43500 this_obj_conv.inner = (void*)(this_obj & (~1));
43501 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43502 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43503 FilesystemPersister_free(this_obj_conv);
43506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
43507 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
43508 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
43509 int64_t ret_ref = 0;
43510 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43511 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43512 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43513 ret_ref = (uintptr_t)ret_var.inner;
43514 if (ret_var.is_owned) {
43520 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
43521 LDKFilesystemPersister this_arg_conv;
43522 this_arg_conv.inner = (void*)(this_arg & (~1));
43523 this_arg_conv.is_owned = false;
43524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43525 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
43526 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
43531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
43532 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
43533 LDKChannelManager manager_conv;
43534 manager_conv.inner = (void*)(manager & (~1));
43535 manager_conv.is_owned = false;
43536 CHECK_INNER_FIELD_ACCESS_OR_NULL(manager_conv);
43537 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
43538 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
43539 return (int64_t)ret_conv;
43542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1network_1graph(JNIEnv *env, jclass clz, jstring data_dir, int64_t network_graph) {
43543 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
43544 LDKNetworkGraph network_graph_conv;
43545 network_graph_conv.inner = (void*)(network_graph & (~1));
43546 network_graph_conv.is_owned = false;
43547 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43548 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
43549 *ret_conv = FilesystemPersister_persist_network_graph(data_dir_conv, &network_graph_conv);
43550 return (int64_t)ret_conv;
43553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
43554 LDKFilesystemPersister this_arg_conv;
43555 this_arg_conv.inner = (void*)(this_arg & (~1));
43556 this_arg_conv.is_owned = false;
43557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43558 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
43559 CHECK_ACCESS(keys_manager_ptr);
43560 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
43561 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
43562 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43563 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
43565 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
43566 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
43567 return (int64_t)ret_conv;
43570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
43571 LDKFilesystemPersister this_arg_conv;
43572 this_arg_conv.inner = (void*)(this_arg & (~1));
43573 this_arg_conv.is_owned = false;
43574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43575 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
43576 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
43577 return (int64_t)ret_ret;
43580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43581 LDKBackgroundProcessor this_obj_conv;
43582 this_obj_conv.inner = (void*)(this_obj & (~1));
43583 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43585 BackgroundProcessor_free(this_obj_conv);
43588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43589 if ((this_ptr & 1) != 0) return;
43590 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43591 CHECK_ACCESS(this_ptr_ptr);
43592 LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
43593 FREE((void*)this_ptr);
43594 Persister_free(this_ptr_conv);
43597 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) {
43598 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
43599 CHECK_ACCESS(persister_ptr);
43600 LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
43601 if (persister_conv.free == LDKPersister_JCalls_free) {
43602 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43603 LDKPersister_JCalls_cloned(&persister_conv);
43605 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
43606 CHECK_ACCESS(event_handler_ptr);
43607 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
43608 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
43609 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43610 LDKEventHandler_JCalls_cloned(&event_handler_conv);
43612 LDKChainMonitor chain_monitor_conv;
43613 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
43614 chain_monitor_conv.is_owned = false;
43615 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
43616 LDKChannelManager channel_manager_conv;
43617 channel_manager_conv.inner = (void*)(channel_manager & (~1));
43618 channel_manager_conv.is_owned = false;
43619 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
43620 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
43621 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
43622 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
43623 CHECK_INNER_FIELD_ACCESS_OR_NULL(net_graph_msg_handler_conv);
43624 LDKPeerManager peer_manager_conv;
43625 peer_manager_conv.inner = (void*)(peer_manager & (~1));
43626 peer_manager_conv.is_owned = false;
43627 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
43628 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
43629 CHECK_ACCESS(logger_ptr);
43630 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43631 if (logger_conv.free == LDKLogger_JCalls_free) {
43632 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43633 LDKLogger_JCalls_cloned(&logger_conv);
43635 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);
43636 int64_t ret_ref = 0;
43637 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43638 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43639 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43640 ret_ref = (uintptr_t)ret_var.inner;
43641 if (ret_var.is_owned) {
43647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
43648 LDKBackgroundProcessor this_arg_conv;
43649 this_arg_conv.inner = (void*)(this_arg & (~1));
43650 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43652 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
43653 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
43654 *ret_conv = BackgroundProcessor_join(this_arg_conv);
43655 return (int64_t)ret_conv;
43658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
43659 LDKBackgroundProcessor this_arg_conv;
43660 this_arg_conv.inner = (void*)(this_arg & (~1));
43661 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43662 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43663 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
43664 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
43665 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
43666 return (int64_t)ret_conv;
43669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43670 if ((this_ptr & 1) != 0) return;
43671 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43672 CHECK_ACCESS(this_ptr_ptr);
43673 LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
43674 FREE((void*)this_ptr);
43675 ParseError_free(this_ptr_conv);
43678 static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
43679 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43680 *ret_copy = ParseError_clone(arg);
43681 int64_t ret_ref = (uintptr_t)ret_copy;
43684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43685 LDKParseError* arg_conv = (LDKParseError*)arg;
43686 int64_t ret_conv = ParseError_clone_ptr(arg_conv);
43690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43691 LDKParseError* orig_conv = (LDKParseError*)orig;
43692 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43693 *ret_copy = ParseError_clone(orig_conv);
43694 int64_t ret_ref = (uintptr_t)ret_copy;
43698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
43699 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
43700 CHECK_ACCESS(a_ptr);
43701 LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
43702 a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1));
43703 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43704 *ret_copy = ParseError_bech32_error(a_conv);
43705 int64_t ret_ref = (uintptr_t)ret_copy;
43709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
43711 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43712 *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
43713 int64_t ret_ref = (uintptr_t)ret_copy;
43717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
43718 LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
43719 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43720 *ret_copy = ParseError_malformed_signature(a_conv);
43721 int64_t ret_ref = (uintptr_t)ret_copy;
43725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
43726 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43727 *ret_copy = ParseError_bad_prefix();
43728 int64_t ret_ref = (uintptr_t)ret_copy;
43732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
43733 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43734 *ret_copy = ParseError_unknown_currency();
43735 int64_t ret_ref = (uintptr_t)ret_copy;
43739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
43740 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43741 *ret_copy = ParseError_unknown_si_prefix();
43742 int64_t ret_ref = (uintptr_t)ret_copy;
43746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
43747 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43748 *ret_copy = ParseError_malformed_hrp();
43749 int64_t ret_ref = (uintptr_t)ret_copy;
43753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
43754 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43755 *ret_copy = ParseError_too_short_data_part();
43756 int64_t ret_ref = (uintptr_t)ret_copy;
43760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
43761 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43762 *ret_copy = ParseError_unexpected_end_of_tagged_fields();
43763 int64_t ret_ref = (uintptr_t)ret_copy;
43767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
43769 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43770 *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
43771 int64_t ret_ref = (uintptr_t)ret_copy;
43775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) {
43776 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43777 *ret_copy = ParseError_padding_error();
43778 int64_t ret_ref = (uintptr_t)ret_copy;
43782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
43783 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43784 *ret_copy = ParseError_integer_overflow_error();
43785 int64_t ret_ref = (uintptr_t)ret_copy;
43789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
43790 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43791 *ret_copy = ParseError_invalid_seg_wit_program_length();
43792 int64_t ret_ref = (uintptr_t)ret_copy;
43796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
43797 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43798 *ret_copy = ParseError_invalid_pub_key_hash_length();
43799 int64_t ret_ref = (uintptr_t)ret_copy;
43803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
43804 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43805 *ret_copy = ParseError_invalid_script_hash_length();
43806 int64_t ret_ref = (uintptr_t)ret_copy;
43810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
43811 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43812 *ret_copy = ParseError_invalid_recovery_id();
43813 int64_t ret_ref = (uintptr_t)ret_copy;
43817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
43818 LDKStr a_conv = java_to_owned_str(env, a);
43819 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43820 *ret_copy = ParseError_invalid_slice_length(a_conv);
43821 int64_t ret_ref = (uintptr_t)ret_copy;
43825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) {
43826 LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43827 *ret_copy = ParseError_skip();
43828 int64_t ret_ref = (uintptr_t)ret_copy;
43832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43833 if ((this_ptr & 1) != 0) return;
43834 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43835 CHECK_ACCESS(this_ptr_ptr);
43836 LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
43837 FREE((void*)this_ptr);
43838 ParseOrSemanticError_free(this_ptr_conv);
43841 static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
43842 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43843 *ret_copy = ParseOrSemanticError_clone(arg);
43844 int64_t ret_ref = (uintptr_t)ret_copy;
43847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43848 LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg;
43849 int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
43853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43854 LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig;
43855 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43856 *ret_copy = ParseOrSemanticError_clone(orig_conv);
43857 int64_t ret_ref = (uintptr_t)ret_copy;
43861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
43862 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
43863 CHECK_ACCESS(a_ptr);
43864 LDKParseError a_conv = *(LDKParseError*)(a_ptr);
43865 a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1));
43866 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43867 *ret_copy = ParseOrSemanticError_parse_error(a_conv);
43868 int64_t ret_ref = (uintptr_t)ret_copy;
43872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
43873 LDKSemanticError a_conv = LDKSemanticError_from_java(env, a);
43874 LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43875 *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
43876 int64_t ret_ref = (uintptr_t)ret_copy;
43880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43881 LDKInvoice this_obj_conv;
43882 this_obj_conv.inner = (void*)(this_obj & (~1));
43883 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43885 Invoice_free(this_obj_conv);
43888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43890 a_conv.inner = (void*)(a & (~1));
43891 a_conv.is_owned = false;
43892 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43894 b_conv.inner = (void*)(b & (~1));
43895 b_conv.is_owned = false;
43896 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43897 jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
43901 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
43902 LDKInvoice ret_var = Invoice_clone(arg);
43903 int64_t ret_ref = 0;
43904 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43905 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43906 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43907 ret_ref = (uintptr_t)ret_var.inner;
43908 if (ret_var.is_owned) {
43913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43914 LDKInvoice arg_conv;
43915 arg_conv.inner = (void*)(arg & (~1));
43916 arg_conv.is_owned = false;
43917 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43918 int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
43922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43923 LDKInvoice orig_conv;
43924 orig_conv.inner = (void*)(orig & (~1));
43925 orig_conv.is_owned = false;
43926 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43927 LDKInvoice ret_var = Invoice_clone(&orig_conv);
43928 int64_t ret_ref = 0;
43929 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43930 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43931 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43932 ret_ref = (uintptr_t)ret_var.inner;
43933 if (ret_var.is_owned) {
43939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43940 LDKSignedRawInvoice this_obj_conv;
43941 this_obj_conv.inner = (void*)(this_obj & (~1));
43942 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43944 SignedRawInvoice_free(this_obj_conv);
43947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43948 LDKSignedRawInvoice a_conv;
43949 a_conv.inner = (void*)(a & (~1));
43950 a_conv.is_owned = false;
43951 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43952 LDKSignedRawInvoice b_conv;
43953 b_conv.inner = (void*)(b & (~1));
43954 b_conv.is_owned = false;
43955 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43956 jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
43960 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
43961 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
43962 int64_t ret_ref = 0;
43963 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43964 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43965 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43966 ret_ref = (uintptr_t)ret_var.inner;
43967 if (ret_var.is_owned) {
43972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43973 LDKSignedRawInvoice arg_conv;
43974 arg_conv.inner = (void*)(arg & (~1));
43975 arg_conv.is_owned = false;
43976 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43977 int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
43981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43982 LDKSignedRawInvoice orig_conv;
43983 orig_conv.inner = (void*)(orig & (~1));
43984 orig_conv.is_owned = false;
43985 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43986 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
43987 int64_t ret_ref = 0;
43988 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43989 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43990 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43991 ret_ref = (uintptr_t)ret_var.inner;
43992 if (ret_var.is_owned) {
43998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43999 LDKRawInvoice this_obj_conv;
44000 this_obj_conv.inner = (void*)(this_obj & (~1));
44001 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44003 RawInvoice_free(this_obj_conv);
44006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
44007 LDKRawInvoice this_ptr_conv;
44008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44009 this_ptr_conv.is_owned = false;
44010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44011 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
44012 int64_t ret_ref = 0;
44013 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44014 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44015 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44016 ret_ref = (uintptr_t)ret_var.inner;
44017 if (ret_var.is_owned) {
44023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44024 LDKRawInvoice this_ptr_conv;
44025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44026 this_ptr_conv.is_owned = false;
44027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44028 LDKRawDataPart val_conv;
44029 val_conv.inner = (void*)(val & (~1));
44030 val_conv.is_owned = (val & 1) || (val == 0);
44031 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44032 val_conv = RawDataPart_clone(&val_conv);
44033 RawInvoice_set_data(&this_ptr_conv, val_conv);
44036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44037 LDKRawInvoice a_conv;
44038 a_conv.inner = (void*)(a & (~1));
44039 a_conv.is_owned = false;
44040 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44041 LDKRawInvoice b_conv;
44042 b_conv.inner = (void*)(b & (~1));
44043 b_conv.is_owned = false;
44044 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44045 jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
44049 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
44050 LDKRawInvoice ret_var = RawInvoice_clone(arg);
44051 int64_t ret_ref = 0;
44052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44055 ret_ref = (uintptr_t)ret_var.inner;
44056 if (ret_var.is_owned) {
44061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44062 LDKRawInvoice arg_conv;
44063 arg_conv.inner = (void*)(arg & (~1));
44064 arg_conv.is_owned = false;
44065 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44066 int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
44070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44071 LDKRawInvoice orig_conv;
44072 orig_conv.inner = (void*)(orig & (~1));
44073 orig_conv.is_owned = false;
44074 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44075 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
44076 int64_t ret_ref = 0;
44077 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44078 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44079 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44080 ret_ref = (uintptr_t)ret_var.inner;
44081 if (ret_var.is_owned) {
44087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44088 LDKRawDataPart this_obj_conv;
44089 this_obj_conv.inner = (void*)(this_obj & (~1));
44090 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44092 RawDataPart_free(this_obj_conv);
44095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
44096 LDKRawDataPart this_ptr_conv;
44097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44098 this_ptr_conv.is_owned = false;
44099 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44100 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
44101 int64_t ret_ref = 0;
44102 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44103 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44105 ret_ref = (uintptr_t)ret_var.inner;
44106 if (ret_var.is_owned) {
44112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44113 LDKRawDataPart this_ptr_conv;
44114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44115 this_ptr_conv.is_owned = false;
44116 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44117 LDKPositiveTimestamp val_conv;
44118 val_conv.inner = (void*)(val & (~1));
44119 val_conv.is_owned = (val & 1) || (val == 0);
44120 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44121 val_conv = PositiveTimestamp_clone(&val_conv);
44122 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
44125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44126 LDKRawDataPart a_conv;
44127 a_conv.inner = (void*)(a & (~1));
44128 a_conv.is_owned = false;
44129 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44130 LDKRawDataPart b_conv;
44131 b_conv.inner = (void*)(b & (~1));
44132 b_conv.is_owned = false;
44133 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44134 jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
44138 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
44139 LDKRawDataPart ret_var = RawDataPart_clone(arg);
44140 int64_t ret_ref = 0;
44141 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44142 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44144 ret_ref = (uintptr_t)ret_var.inner;
44145 if (ret_var.is_owned) {
44150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44151 LDKRawDataPart arg_conv;
44152 arg_conv.inner = (void*)(arg & (~1));
44153 arg_conv.is_owned = false;
44154 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44155 int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
44159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44160 LDKRawDataPart orig_conv;
44161 orig_conv.inner = (void*)(orig & (~1));
44162 orig_conv.is_owned = false;
44163 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44164 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
44165 int64_t ret_ref = 0;
44166 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44167 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44168 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44169 ret_ref = (uintptr_t)ret_var.inner;
44170 if (ret_var.is_owned) {
44176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44177 LDKPositiveTimestamp this_obj_conv;
44178 this_obj_conv.inner = (void*)(this_obj & (~1));
44179 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44180 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44181 PositiveTimestamp_free(this_obj_conv);
44184 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44185 LDKPositiveTimestamp a_conv;
44186 a_conv.inner = (void*)(a & (~1));
44187 a_conv.is_owned = false;
44188 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44189 LDKPositiveTimestamp b_conv;
44190 b_conv.inner = (void*)(b & (~1));
44191 b_conv.is_owned = false;
44192 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44193 jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
44197 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
44198 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
44199 int64_t ret_ref = 0;
44200 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44201 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44203 ret_ref = (uintptr_t)ret_var.inner;
44204 if (ret_var.is_owned) {
44209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44210 LDKPositiveTimestamp arg_conv;
44211 arg_conv.inner = (void*)(arg & (~1));
44212 arg_conv.is_owned = false;
44213 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44214 int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
44218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44219 LDKPositiveTimestamp orig_conv;
44220 orig_conv.inner = (void*)(orig & (~1));
44221 orig_conv.is_owned = false;
44222 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44223 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
44224 int64_t ret_ref = 0;
44225 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44226 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44228 ret_ref = (uintptr_t)ret_var.inner;
44229 if (ret_var.is_owned) {
44235 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44236 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
44237 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
44241 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
44242 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
44246 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
44247 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
44251 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
44252 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
44256 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
44257 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
44261 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44262 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
44263 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
44264 jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
44268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
44269 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
44270 int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
44274 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44275 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
44276 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
44280 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
44281 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
44285 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
44286 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
44290 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
44291 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
44295 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
44296 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
44300 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
44301 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
44305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
44306 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
44307 int64_t ret_conv = Currency_hash(o_conv);
44311 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44312 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
44313 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
44314 jboolean ret_conv = Currency_eq(a_conv, b_conv);
44318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44319 LDKSha256 this_obj_conv;
44320 this_obj_conv.inner = (void*)(this_obj & (~1));
44321 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44323 Sha256_free(this_obj_conv);
44326 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
44327 LDKSha256 ret_var = Sha256_clone(arg);
44328 int64_t ret_ref = 0;
44329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44332 ret_ref = (uintptr_t)ret_var.inner;
44333 if (ret_var.is_owned) {
44338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44339 LDKSha256 arg_conv;
44340 arg_conv.inner = (void*)(arg & (~1));
44341 arg_conv.is_owned = false;
44342 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44343 int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
44347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44348 LDKSha256 orig_conv;
44349 orig_conv.inner = (void*)(orig & (~1));
44350 orig_conv.is_owned = false;
44351 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44352 LDKSha256 ret_var = Sha256_clone(&orig_conv);
44353 int64_t ret_ref = 0;
44354 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44355 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44357 ret_ref = (uintptr_t)ret_var.inner;
44358 if (ret_var.is_owned) {
44364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
44366 o_conv.inner = (void*)(o & (~1));
44367 o_conv.is_owned = false;
44368 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44369 int64_t ret_conv = Sha256_hash(&o_conv);
44373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44375 a_conv.inner = (void*)(a & (~1));
44376 a_conv.is_owned = false;
44377 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44379 b_conv.inner = (void*)(b & (~1));
44380 b_conv.is_owned = false;
44381 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44382 jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
44386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44387 LDKDescription this_obj_conv;
44388 this_obj_conv.inner = (void*)(this_obj & (~1));
44389 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44390 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44391 Description_free(this_obj_conv);
44394 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
44395 LDKDescription ret_var = Description_clone(arg);
44396 int64_t ret_ref = 0;
44397 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44398 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44400 ret_ref = (uintptr_t)ret_var.inner;
44401 if (ret_var.is_owned) {
44406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44407 LDKDescription arg_conv;
44408 arg_conv.inner = (void*)(arg & (~1));
44409 arg_conv.is_owned = false;
44410 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44411 int64_t ret_conv = Description_clone_ptr(&arg_conv);
44415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44416 LDKDescription orig_conv;
44417 orig_conv.inner = (void*)(orig & (~1));
44418 orig_conv.is_owned = false;
44419 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44420 LDKDescription ret_var = Description_clone(&orig_conv);
44421 int64_t ret_ref = 0;
44422 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44423 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44424 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44425 ret_ref = (uintptr_t)ret_var.inner;
44426 if (ret_var.is_owned) {
44432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
44433 LDKDescription o_conv;
44434 o_conv.inner = (void*)(o & (~1));
44435 o_conv.is_owned = false;
44436 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44437 int64_t ret_conv = Description_hash(&o_conv);
44441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44442 LDKDescription a_conv;
44443 a_conv.inner = (void*)(a & (~1));
44444 a_conv.is_owned = false;
44445 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44446 LDKDescription b_conv;
44447 b_conv.inner = (void*)(b & (~1));
44448 b_conv.is_owned = false;
44449 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44450 jboolean ret_conv = Description_eq(&a_conv, &b_conv);
44454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44455 LDKPayeePubKey this_obj_conv;
44456 this_obj_conv.inner = (void*)(this_obj & (~1));
44457 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44459 PayeePubKey_free(this_obj_conv);
44462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44463 LDKPayeePubKey this_ptr_conv;
44464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44465 this_ptr_conv.is_owned = false;
44466 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44467 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44468 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
44472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44473 LDKPayeePubKey this_ptr_conv;
44474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44475 this_ptr_conv.is_owned = false;
44476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44477 LDKPublicKey val_ref;
44478 CHECK((*env)->GetArrayLength(env, val) == 33);
44479 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
44480 PayeePubKey_set_a(&this_ptr_conv, val_ref);
44483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
44484 LDKPublicKey a_arg_ref;
44485 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
44486 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
44487 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
44488 int64_t ret_ref = 0;
44489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44492 ret_ref = (uintptr_t)ret_var.inner;
44493 if (ret_var.is_owned) {
44499 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
44500 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
44501 int64_t ret_ref = 0;
44502 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44503 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44504 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44505 ret_ref = (uintptr_t)ret_var.inner;
44506 if (ret_var.is_owned) {
44511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44512 LDKPayeePubKey arg_conv;
44513 arg_conv.inner = (void*)(arg & (~1));
44514 arg_conv.is_owned = false;
44515 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44516 int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
44520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44521 LDKPayeePubKey orig_conv;
44522 orig_conv.inner = (void*)(orig & (~1));
44523 orig_conv.is_owned = false;
44524 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44525 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
44526 int64_t ret_ref = 0;
44527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44530 ret_ref = (uintptr_t)ret_var.inner;
44531 if (ret_var.is_owned) {
44537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
44538 LDKPayeePubKey o_conv;
44539 o_conv.inner = (void*)(o & (~1));
44540 o_conv.is_owned = false;
44541 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44542 int64_t ret_conv = PayeePubKey_hash(&o_conv);
44546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44547 LDKPayeePubKey a_conv;
44548 a_conv.inner = (void*)(a & (~1));
44549 a_conv.is_owned = false;
44550 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44551 LDKPayeePubKey b_conv;
44552 b_conv.inner = (void*)(b & (~1));
44553 b_conv.is_owned = false;
44554 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44555 jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
44559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44560 LDKExpiryTime this_obj_conv;
44561 this_obj_conv.inner = (void*)(this_obj & (~1));
44562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44564 ExpiryTime_free(this_obj_conv);
44567 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
44568 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
44569 int64_t ret_ref = 0;
44570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44573 ret_ref = (uintptr_t)ret_var.inner;
44574 if (ret_var.is_owned) {
44579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44580 LDKExpiryTime arg_conv;
44581 arg_conv.inner = (void*)(arg & (~1));
44582 arg_conv.is_owned = false;
44583 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44584 int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
44588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44589 LDKExpiryTime orig_conv;
44590 orig_conv.inner = (void*)(orig & (~1));
44591 orig_conv.is_owned = false;
44592 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44593 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
44594 int64_t ret_ref = 0;
44595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44598 ret_ref = (uintptr_t)ret_var.inner;
44599 if (ret_var.is_owned) {
44605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
44606 LDKExpiryTime o_conv;
44607 o_conv.inner = (void*)(o & (~1));
44608 o_conv.is_owned = false;
44609 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44610 int64_t ret_conv = ExpiryTime_hash(&o_conv);
44614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44615 LDKExpiryTime a_conv;
44616 a_conv.inner = (void*)(a & (~1));
44617 a_conv.is_owned = false;
44618 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44619 LDKExpiryTime b_conv;
44620 b_conv.inner = (void*)(b & (~1));
44621 b_conv.is_owned = false;
44622 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44623 jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
44627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44628 LDKMinFinalCltvExpiry this_obj_conv;
44629 this_obj_conv.inner = (void*)(this_obj & (~1));
44630 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44631 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44632 MinFinalCltvExpiry_free(this_obj_conv);
44635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44636 LDKMinFinalCltvExpiry this_ptr_conv;
44637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44638 this_ptr_conv.is_owned = false;
44639 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44640 int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
44644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44645 LDKMinFinalCltvExpiry this_ptr_conv;
44646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44647 this_ptr_conv.is_owned = false;
44648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44649 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
44652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
44653 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
44654 int64_t ret_ref = 0;
44655 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44656 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44658 ret_ref = (uintptr_t)ret_var.inner;
44659 if (ret_var.is_owned) {
44665 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
44666 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
44667 int64_t ret_ref = 0;
44668 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44669 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44670 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44671 ret_ref = (uintptr_t)ret_var.inner;
44672 if (ret_var.is_owned) {
44677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44678 LDKMinFinalCltvExpiry arg_conv;
44679 arg_conv.inner = (void*)(arg & (~1));
44680 arg_conv.is_owned = false;
44681 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44682 int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
44686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44687 LDKMinFinalCltvExpiry orig_conv;
44688 orig_conv.inner = (void*)(orig & (~1));
44689 orig_conv.is_owned = false;
44690 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44691 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
44692 int64_t ret_ref = 0;
44693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44696 ret_ref = (uintptr_t)ret_var.inner;
44697 if (ret_var.is_owned) {
44703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
44704 LDKMinFinalCltvExpiry o_conv;
44705 o_conv.inner = (void*)(o & (~1));
44706 o_conv.is_owned = false;
44707 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44708 int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
44712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44713 LDKMinFinalCltvExpiry a_conv;
44714 a_conv.inner = (void*)(a & (~1));
44715 a_conv.is_owned = false;
44716 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44717 LDKMinFinalCltvExpiry b_conv;
44718 b_conv.inner = (void*)(b & (~1));
44719 b_conv.is_owned = false;
44720 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44721 jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
44725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44726 if ((this_ptr & 1) != 0) return;
44727 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44728 CHECK_ACCESS(this_ptr_ptr);
44729 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
44730 FREE((void*)this_ptr);
44731 Fallback_free(this_ptr_conv);
44734 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
44735 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44736 *ret_copy = Fallback_clone(arg);
44737 int64_t ret_ref = (uintptr_t)ret_copy;
44740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44741 LDKFallback* arg_conv = (LDKFallback*)arg;
44742 int64_t ret_conv = Fallback_clone_ptr(arg_conv);
44746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44747 LDKFallback* orig_conv = (LDKFallback*)orig;
44748 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44749 *ret_copy = Fallback_clone(orig_conv);
44750 int64_t ret_ref = (uintptr_t)ret_copy;
44754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
44756 LDKCVec_u8Z program_ref;
44757 program_ref.datalen = (*env)->GetArrayLength(env, program);
44758 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
44759 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
44760 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44761 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
44762 int64_t ret_ref = (uintptr_t)ret_copy;
44766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
44767 LDKTwentyBytes a_ref;
44768 CHECK((*env)->GetArrayLength(env, a) == 20);
44769 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
44770 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44771 *ret_copy = Fallback_pub_key_hash(a_ref);
44772 int64_t ret_ref = (uintptr_t)ret_copy;
44776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
44777 LDKTwentyBytes a_ref;
44778 CHECK((*env)->GetArrayLength(env, a) == 20);
44779 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
44780 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44781 *ret_copy = Fallback_script_hash(a_ref);
44782 int64_t ret_ref = (uintptr_t)ret_copy;
44786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
44787 LDKFallback* o_conv = (LDKFallback*)o;
44788 int64_t ret_conv = Fallback_hash(o_conv);
44792 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44793 LDKFallback* a_conv = (LDKFallback*)a;
44794 LDKFallback* b_conv = (LDKFallback*)b;
44795 jboolean ret_conv = Fallback_eq(a_conv, b_conv);
44799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44800 LDKInvoiceSignature this_obj_conv;
44801 this_obj_conv.inner = (void*)(this_obj & (~1));
44802 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44804 InvoiceSignature_free(this_obj_conv);
44807 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
44808 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
44809 int64_t ret_ref = 0;
44810 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44811 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44813 ret_ref = (uintptr_t)ret_var.inner;
44814 if (ret_var.is_owned) {
44819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44820 LDKInvoiceSignature arg_conv;
44821 arg_conv.inner = (void*)(arg & (~1));
44822 arg_conv.is_owned = false;
44823 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44824 int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
44828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44829 LDKInvoiceSignature orig_conv;
44830 orig_conv.inner = (void*)(orig & (~1));
44831 orig_conv.is_owned = false;
44832 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44833 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
44834 int64_t ret_ref = 0;
44835 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44836 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44838 ret_ref = (uintptr_t)ret_var.inner;
44839 if (ret_var.is_owned) {
44845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44846 LDKInvoiceSignature a_conv;
44847 a_conv.inner = (void*)(a & (~1));
44848 a_conv.is_owned = false;
44849 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44850 LDKInvoiceSignature b_conv;
44851 b_conv.inner = (void*)(b & (~1));
44852 b_conv.is_owned = false;
44853 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44854 jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
44858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44859 LDKPrivateRoute this_obj_conv;
44860 this_obj_conv.inner = (void*)(this_obj & (~1));
44861 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44863 PrivateRoute_free(this_obj_conv);
44866 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
44867 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
44868 int64_t ret_ref = 0;
44869 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44870 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44871 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44872 ret_ref = (uintptr_t)ret_var.inner;
44873 if (ret_var.is_owned) {
44878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44879 LDKPrivateRoute arg_conv;
44880 arg_conv.inner = (void*)(arg & (~1));
44881 arg_conv.is_owned = false;
44882 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44883 int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
44887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44888 LDKPrivateRoute orig_conv;
44889 orig_conv.inner = (void*)(orig & (~1));
44890 orig_conv.is_owned = false;
44891 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44892 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
44893 int64_t ret_ref = 0;
44894 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44895 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44897 ret_ref = (uintptr_t)ret_var.inner;
44898 if (ret_var.is_owned) {
44904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
44905 LDKPrivateRoute o_conv;
44906 o_conv.inner = (void*)(o & (~1));
44907 o_conv.is_owned = false;
44908 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44909 int64_t ret_conv = PrivateRoute_hash(&o_conv);
44913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44914 LDKPrivateRoute a_conv;
44915 a_conv.inner = (void*)(a & (~1));
44916 a_conv.is_owned = false;
44917 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44918 LDKPrivateRoute b_conv;
44919 b_conv.inner = (void*)(b & (~1));
44920 b_conv.is_owned = false;
44921 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44922 jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
44926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
44927 LDKSignedRawInvoice this_arg_conv;
44928 this_arg_conv.inner = (void*)(this_arg & (~1));
44929 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44931 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
44932 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
44933 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
44934 return ((int64_t)ret_conv);
44937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
44938 LDKSignedRawInvoice this_arg_conv;
44939 this_arg_conv.inner = (void*)(this_arg & (~1));
44940 this_arg_conv.is_owned = false;
44941 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44942 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
44943 int64_t ret_ref = 0;
44944 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44945 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44946 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44947 ret_ref = (uintptr_t)ret_var.inner;
44948 if (ret_var.is_owned) {
44954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44955 LDKSignedRawInvoice this_arg_conv;
44956 this_arg_conv.inner = (void*)(this_arg & (~1));
44957 this_arg_conv.is_owned = false;
44958 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44959 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44960 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
44964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
44965 LDKSignedRawInvoice this_arg_conv;
44966 this_arg_conv.inner = (void*)(this_arg & (~1));
44967 this_arg_conv.is_owned = false;
44968 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44969 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
44970 int64_t ret_ref = 0;
44971 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44972 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44974 ret_ref = (uintptr_t)ret_var.inner;
44975 if (ret_var.is_owned) {
44981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
44982 LDKSignedRawInvoice this_arg_conv;
44983 this_arg_conv.inner = (void*)(this_arg & (~1));
44984 this_arg_conv.is_owned = false;
44985 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44986 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
44987 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
44988 return (int64_t)ret_conv;
44991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
44992 LDKSignedRawInvoice this_arg_conv;
44993 this_arg_conv.inner = (void*)(this_arg & (~1));
44994 this_arg_conv.is_owned = false;
44995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44996 jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
45000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
45001 LDKRawInvoice this_arg_conv;
45002 this_arg_conv.inner = (void*)(this_arg & (~1));
45003 this_arg_conv.is_owned = false;
45004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45005 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45006 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
45010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
45011 LDKRawInvoice this_arg_conv;
45012 this_arg_conv.inner = (void*)(this_arg & (~1));
45013 this_arg_conv.is_owned = false;
45014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45015 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
45016 int64_t ret_ref = 0;
45017 if ((uintptr_t)ret_var.inner > 4096) {
45018 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45019 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45020 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45021 ret_ref = (uintptr_t)ret_var.inner;
45022 if (ret_var.is_owned) {
45029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
45030 LDKRawInvoice this_arg_conv;
45031 this_arg_conv.inner = (void*)(this_arg & (~1));
45032 this_arg_conv.is_owned = false;
45033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45034 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
45035 int64_t ret_ref = 0;
45036 if ((uintptr_t)ret_var.inner > 4096) {
45037 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45038 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45039 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45040 ret_ref = (uintptr_t)ret_var.inner;
45041 if (ret_var.is_owned) {
45048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45049 LDKRawInvoice this_arg_conv;
45050 this_arg_conv.inner = (void*)(this_arg & (~1));
45051 this_arg_conv.is_owned = false;
45052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45053 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
45054 int64_t ret_ref = 0;
45055 if ((uintptr_t)ret_var.inner > 4096) {
45056 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45057 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45059 ret_ref = (uintptr_t)ret_var.inner;
45060 if (ret_var.is_owned) {
45067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
45068 LDKRawInvoice this_arg_conv;
45069 this_arg_conv.inner = (void*)(this_arg & (~1));
45070 this_arg_conv.is_owned = false;
45071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45072 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
45073 int64_t ret_ref = 0;
45074 if ((uintptr_t)ret_var.inner > 4096) {
45075 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45076 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45077 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45078 ret_ref = (uintptr_t)ret_var.inner;
45079 if (ret_var.is_owned) {
45086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
45087 LDKRawInvoice this_arg_conv;
45088 this_arg_conv.inner = (void*)(this_arg & (~1));
45089 this_arg_conv.is_owned = false;
45090 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45091 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
45092 int64_t ret_ref = 0;
45093 if ((uintptr_t)ret_var.inner > 4096) {
45094 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45095 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45096 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45097 ret_ref = (uintptr_t)ret_var.inner;
45098 if (ret_var.is_owned) {
45105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
45106 LDKRawInvoice this_arg_conv;
45107 this_arg_conv.inner = (void*)(this_arg & (~1));
45108 this_arg_conv.is_owned = false;
45109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45110 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
45111 int64_t ret_ref = 0;
45112 if ((uintptr_t)ret_var.inner > 4096) {
45113 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45114 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45115 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45116 ret_ref = (uintptr_t)ret_var.inner;
45117 if (ret_var.is_owned) {
45124 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
45125 LDKRawInvoice this_arg_conv;
45126 this_arg_conv.inner = (void*)(this_arg & (~1));
45127 this_arg_conv.is_owned = false;
45128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45129 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45130 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
45134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
45135 LDKRawInvoice this_arg_conv;
45136 this_arg_conv.inner = (void*)(this_arg & (~1));
45137 this_arg_conv.is_owned = false;
45138 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45139 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
45140 int64_t ret_ref = 0;
45141 if ((uintptr_t)ret_var.inner > 4096) {
45142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45145 ret_ref = (uintptr_t)ret_var.inner;
45146 if (ret_var.is_owned) {
45153 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
45154 LDKRawInvoice this_arg_conv;
45155 this_arg_conv.inner = (void*)(this_arg & (~1));
45156 this_arg_conv.is_owned = false;
45157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45158 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
45159 int64_tArray ret_arr = NULL;
45160 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45161 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45162 for (size_t o = 0; o < ret_var.datalen; o++) {
45163 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
45164 int64_t ret_conv_14_ref = 0;
45165 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45166 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
45168 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
45169 if (ret_conv_14_var.is_owned) {
45170 ret_conv_14_ref |= 1;
45172 ret_arr_ptr[o] = ret_conv_14_ref;
45174 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45175 FREE(ret_var.data);
45179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
45180 LDKRawInvoice this_arg_conv;
45181 this_arg_conv.inner = (void*)(this_arg & (~1));
45182 this_arg_conv.is_owned = false;
45183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45184 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45185 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
45186 int64_t ret_ref = (uintptr_t)ret_copy;
45190 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
45191 LDKRawInvoice this_arg_conv;
45192 this_arg_conv.inner = (void*)(this_arg & (~1));
45193 this_arg_conv.is_owned = false;
45194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45195 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
45199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
45200 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
45201 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
45202 return (int64_t)ret_conv;
45205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
45206 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
45207 *ret_conv = PositiveTimestamp_from_system_time(time);
45208 return (int64_t)ret_conv;
45211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
45212 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
45213 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
45214 return (int64_t)ret_conv;
45217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
45218 LDKPositiveTimestamp this_arg_conv;
45219 this_arg_conv.inner = (void*)(this_arg & (~1));
45220 this_arg_conv.is_owned = false;
45221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45222 int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
45226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
45227 LDKPositiveTimestamp this_arg_conv;
45228 this_arg_conv.inner = (void*)(this_arg & (~1));
45229 this_arg_conv.is_owned = false;
45230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45231 int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
45235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
45236 LDKPositiveTimestamp this_arg_conv;
45237 this_arg_conv.inner = (void*)(this_arg & (~1));
45238 this_arg_conv.is_owned = false;
45239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45240 int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
45244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
45245 LDKInvoice this_arg_conv;
45246 this_arg_conv.inner = (void*)(this_arg & (~1));
45247 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
45248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45249 this_arg_conv = Invoice_clone(&this_arg_conv);
45250 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
45251 int64_t ret_ref = 0;
45252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45255 ret_ref = (uintptr_t)ret_var.inner;
45256 if (ret_var.is_owned) {
45262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
45263 LDKInvoice this_arg_conv;
45264 this_arg_conv.inner = (void*)(this_arg & (~1));
45265 this_arg_conv.is_owned = false;
45266 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45267 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
45268 *ret_conv = Invoice_check_signature(&this_arg_conv);
45269 return (int64_t)ret_conv;
45272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
45273 LDKSignedRawInvoice signed_invoice_conv;
45274 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
45275 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
45276 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
45277 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
45278 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
45279 *ret_conv = Invoice_from_signed(signed_invoice_conv);
45280 return (int64_t)ret_conv;
45283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
45284 LDKInvoice this_arg_conv;
45285 this_arg_conv.inner = (void*)(this_arg & (~1));
45286 this_arg_conv.is_owned = false;
45287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45288 int64_t ret_conv = Invoice_timestamp(&this_arg_conv);
45292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
45293 LDKInvoice this_arg_conv;
45294 this_arg_conv.inner = (void*)(this_arg & (~1));
45295 this_arg_conv.is_owned = false;
45296 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45297 int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
45301 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
45302 LDKInvoice this_arg_conv;
45303 this_arg_conv.inner = (void*)(this_arg & (~1));
45304 this_arg_conv.is_owned = false;
45305 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45306 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45307 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
45311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45312 LDKInvoice this_arg_conv;
45313 this_arg_conv.inner = (void*)(this_arg & (~1));
45314 this_arg_conv.is_owned = false;
45315 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45316 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45317 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
45321 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
45322 LDKInvoice this_arg_conv;
45323 this_arg_conv.inner = (void*)(this_arg & (~1));
45324 this_arg_conv.is_owned = false;
45325 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45326 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45327 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
45331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
45332 LDKInvoice this_arg_conv;
45333 this_arg_conv.inner = (void*)(this_arg & (~1));
45334 this_arg_conv.is_owned = false;
45335 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45336 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
45337 int64_t ret_ref = 0;
45338 if ((uintptr_t)ret_var.inner > 4096) {
45339 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45340 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45341 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45342 ret_ref = (uintptr_t)ret_var.inner;
45343 if (ret_var.is_owned) {
45350 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
45351 LDKInvoice this_arg_conv;
45352 this_arg_conv.inner = (void*)(this_arg & (~1));
45353 this_arg_conv.is_owned = false;
45354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45355 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45356 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
45360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
45361 LDKInvoice this_arg_conv;
45362 this_arg_conv.inner = (void*)(this_arg & (~1));
45363 this_arg_conv.is_owned = false;
45364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45365 int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
45369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
45370 LDKInvoice this_arg_conv;
45371 this_arg_conv.inner = (void*)(this_arg & (~1));
45372 this_arg_conv.is_owned = false;
45373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45374 jboolean ret_conv = Invoice_is_expired(&this_arg_conv);
45378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
45379 LDKInvoice this_arg_conv;
45380 this_arg_conv.inner = (void*)(this_arg & (~1));
45381 this_arg_conv.is_owned = false;
45382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45383 jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
45387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
45388 LDKInvoice this_arg_conv;
45389 this_arg_conv.inner = (void*)(this_arg & (~1));
45390 this_arg_conv.is_owned = false;
45391 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45392 int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
45396 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
45397 LDKInvoice this_arg_conv;
45398 this_arg_conv.inner = (void*)(this_arg & (~1));
45399 this_arg_conv.is_owned = false;
45400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45401 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
45402 int64_tArray ret_arr = NULL;
45403 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45404 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45405 for (size_t o = 0; o < ret_var.datalen; o++) {
45406 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
45407 int64_t ret_conv_14_ref = 0;
45408 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45409 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
45411 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
45412 if (ret_conv_14_var.is_owned) {
45413 ret_conv_14_ref |= 1;
45415 ret_arr_ptr[o] = ret_conv_14_ref;
45417 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45418 FREE(ret_var.data);
45422 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
45423 LDKInvoice this_arg_conv;
45424 this_arg_conv.inner = (void*)(this_arg & (~1));
45425 this_arg_conv.is_owned = false;
45426 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45427 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
45428 int64_tArray ret_arr = NULL;
45429 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45430 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45431 for (size_t l = 0; l < ret_var.datalen; l++) {
45432 LDKRouteHint ret_conv_11_var = ret_var.data[l];
45433 int64_t ret_conv_11_ref = 0;
45434 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45435 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45436 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
45437 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
45438 if (ret_conv_11_var.is_owned) {
45439 ret_conv_11_ref |= 1;
45441 ret_arr_ptr[l] = ret_conv_11_ref;
45443 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45444 FREE(ret_var.data);
45448 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
45449 LDKInvoice this_arg_conv;
45450 this_arg_conv.inner = (void*)(this_arg & (~1));
45451 this_arg_conv.is_owned = false;
45452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45453 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
45457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
45458 LDKInvoice this_arg_conv;
45459 this_arg_conv.inner = (void*)(this_arg & (~1));
45460 this_arg_conv.is_owned = false;
45461 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45462 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45463 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
45464 int64_t ret_ref = (uintptr_t)ret_copy;
45468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
45469 LDKStr description_conv = java_to_owned_str(env, description);
45470 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
45471 *ret_conv = Description_new(description_conv);
45472 return (int64_t)ret_conv;
45475 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
45476 LDKDescription this_arg_conv;
45477 this_arg_conv.inner = (void*)(this_arg & (~1));
45478 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
45479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45480 this_arg_conv = Description_clone(&this_arg_conv);
45481 LDKStr ret_str = Description_into_inner(this_arg_conv);
45482 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
45488 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
45489 int64_t ret_ref = 0;
45490 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45491 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45493 ret_ref = (uintptr_t)ret_var.inner;
45494 if (ret_var.is_owned) {
45500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
45501 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
45502 int64_t ret_ref = 0;
45503 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45504 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45505 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45506 ret_ref = (uintptr_t)ret_var.inner;
45507 if (ret_var.is_owned) {
45513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
45514 LDKExpiryTime this_arg_conv;
45515 this_arg_conv.inner = (void*)(this_arg & (~1));
45516 this_arg_conv.is_owned = false;
45517 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45518 int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
45522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
45523 LDKExpiryTime this_arg_conv;
45524 this_arg_conv.inner = (void*)(this_arg & (~1));
45525 this_arg_conv.is_owned = false;
45526 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45527 int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
45531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
45532 LDKRouteHint hops_conv;
45533 hops_conv.inner = (void*)(hops & (~1));
45534 hops_conv.is_owned = (hops & 1) || (hops == 0);
45535 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
45536 hops_conv = RouteHint_clone(&hops_conv);
45537 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
45538 *ret_conv = PrivateRoute_new(hops_conv);
45539 return (int64_t)ret_conv;
45542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
45543 LDKPrivateRoute this_arg_conv;
45544 this_arg_conv.inner = (void*)(this_arg & (~1));
45545 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
45546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45547 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
45548 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
45549 int64_t ret_ref = 0;
45550 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45551 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45552 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45553 ret_ref = (uintptr_t)ret_var.inner;
45554 if (ret_var.is_owned) {
45560 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45561 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
45562 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
45566 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
45567 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
45571 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
45572 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
45576 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
45577 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
45581 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
45582 jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
45586 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
45587 jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
45591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45592 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
45593 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
45594 jboolean ret_conv = CreationError_eq(a_conv, b_conv);
45598 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45599 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
45600 LDKStr ret_str = CreationError_to_str(o_conv);
45601 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45606 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45607 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
45608 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
45612 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
45613 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
45617 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
45618 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
45622 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
45623 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
45627 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
45628 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
45632 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
45633 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
45637 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
45638 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
45642 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
45643 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
45647 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
45648 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
45652 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
45653 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
45657 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
45658 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
45662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45663 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
45664 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
45665 jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
45669 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45670 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
45671 LDKStr ret_str = SemanticError_to_str(o_conv);
45672 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45678 if ((this_ptr & 1) != 0) return;
45679 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45680 CHECK_ACCESS(this_ptr_ptr);
45681 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
45682 FREE((void*)this_ptr);
45683 SignOrCreationError_free(this_ptr_conv);
45686 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
45687 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45688 *ret_copy = SignOrCreationError_clone(arg);
45689 int64_t ret_ref = (uintptr_t)ret_copy;
45692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45693 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
45694 int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
45698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45699 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
45700 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45701 *ret_copy = SignOrCreationError_clone(orig_conv);
45702 int64_t ret_ref = (uintptr_t)ret_copy;
45706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
45707 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45708 *ret_copy = SignOrCreationError_sign_error();
45709 int64_t ret_ref = (uintptr_t)ret_copy;
45713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
45714 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
45715 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45716 *ret_copy = SignOrCreationError_creation_error(a_conv);
45717 int64_t ret_ref = (uintptr_t)ret_copy;
45721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45722 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
45723 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
45724 jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
45728 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45729 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
45730 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
45731 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45737 LDKInvoicePayer this_obj_conv;
45738 this_obj_conv.inner = (void*)(this_obj & (~1));
45739 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45740 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45741 InvoicePayer_free(this_obj_conv);
45744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45745 if ((this_ptr & 1) != 0) return;
45746 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45747 CHECK_ACCESS(this_ptr_ptr);
45748 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
45749 FREE((void*)this_ptr);
45750 Payer_free(this_ptr_conv);
45753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45754 if ((this_ptr & 1) != 0) return;
45755 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45756 CHECK_ACCESS(this_ptr_ptr);
45757 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
45758 FREE((void*)this_ptr);
45759 Router_free(this_ptr_conv);
45762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45763 LDKRetryAttempts this_obj_conv;
45764 this_obj_conv.inner = (void*)(this_obj & (~1));
45765 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45766 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45767 RetryAttempts_free(this_obj_conv);
45770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
45771 LDKRetryAttempts this_ptr_conv;
45772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45773 this_ptr_conv.is_owned = false;
45774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45775 int64_t ret_conv = RetryAttempts_get_a(&this_ptr_conv);
45779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
45780 LDKRetryAttempts this_ptr_conv;
45781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
45782 this_ptr_conv.is_owned = false;
45783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45784 RetryAttempts_set_a(&this_ptr_conv, val);
45787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
45788 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
45789 int64_t ret_ref = 0;
45790 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45791 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45792 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45793 ret_ref = (uintptr_t)ret_var.inner;
45794 if (ret_var.is_owned) {
45800 static inline uintptr_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
45801 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
45802 int64_t ret_ref = 0;
45803 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45804 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45805 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45806 ret_ref = (uintptr_t)ret_var.inner;
45807 if (ret_var.is_owned) {
45812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45813 LDKRetryAttempts arg_conv;
45814 arg_conv.inner = (void*)(arg & (~1));
45815 arg_conv.is_owned = false;
45816 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45817 int64_t ret_conv = RetryAttempts_clone_ptr(&arg_conv);
45821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45822 LDKRetryAttempts orig_conv;
45823 orig_conv.inner = (void*)(orig & (~1));
45824 orig_conv.is_owned = false;
45825 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45826 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
45827 int64_t ret_ref = 0;
45828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45831 ret_ref = (uintptr_t)ret_var.inner;
45832 if (ret_var.is_owned) {
45838 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45839 LDKRetryAttempts a_conv;
45840 a_conv.inner = (void*)(a & (~1));
45841 a_conv.is_owned = false;
45842 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45843 LDKRetryAttempts b_conv;
45844 b_conv.inner = (void*)(b & (~1));
45845 b_conv.is_owned = false;
45846 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45847 jboolean ret_conv = RetryAttempts_eq(&a_conv, &b_conv);
45851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1hash(JNIEnv *env, jclass clz, int64_t o) {
45852 LDKRetryAttempts o_conv;
45853 o_conv.inner = (void*)(o & (~1));
45854 o_conv.is_owned = false;
45855 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45856 int64_t ret_conv = RetryAttempts_hash(&o_conv);
45860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45861 if ((this_ptr & 1) != 0) return;
45862 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45863 CHECK_ACCESS(this_ptr_ptr);
45864 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
45865 FREE((void*)this_ptr);
45866 PaymentError_free(this_ptr_conv);
45869 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
45870 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45871 *ret_copy = PaymentError_clone(arg);
45872 int64_t ret_ref = (uintptr_t)ret_copy;
45875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45876 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
45877 int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
45881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45882 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
45883 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45884 *ret_copy = PaymentError_clone(orig_conv);
45885 int64_t ret_ref = (uintptr_t)ret_copy;
45889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
45890 LDKStr a_conv = java_to_owned_str(env, a);
45891 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45892 *ret_copy = PaymentError_invoice(a_conv);
45893 int64_t ret_ref = (uintptr_t)ret_copy;
45897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
45898 LDKLightningError a_conv;
45899 a_conv.inner = (void*)(a & (~1));
45900 a_conv.is_owned = (a & 1) || (a == 0);
45901 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45902 a_conv = LightningError_clone(&a_conv);
45903 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45904 *ret_copy = PaymentError_routing(a_conv);
45905 int64_t ret_ref = (uintptr_t)ret_copy;
45909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
45910 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
45911 CHECK_ACCESS(a_ptr);
45912 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
45913 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
45914 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45915 *ret_copy = PaymentError_sending(a_conv);
45916 int64_t ret_ref = (uintptr_t)ret_copy;
45920 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) {
45921 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
45922 CHECK_ACCESS(payer_ptr);
45923 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
45924 if (payer_conv.free == LDKPayer_JCalls_free) {
45925 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45926 LDKPayer_JCalls_cloned(&payer_conv);
45928 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
45929 CHECK_ACCESS(router_ptr);
45930 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
45931 if (router_conv.free == LDKRouter_JCalls_free) {
45932 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45933 LDKRouter_JCalls_cloned(&router_conv);
45935 LDKMultiThreadedLockableScore scorer_conv;
45936 scorer_conv.inner = (void*)(scorer & (~1));
45937 scorer_conv.is_owned = false;
45938 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
45939 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45940 CHECK_ACCESS(logger_ptr);
45941 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45942 if (logger_conv.free == LDKLogger_JCalls_free) {
45943 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45944 LDKLogger_JCalls_cloned(&logger_conv);
45946 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
45947 CHECK_ACCESS(event_handler_ptr);
45948 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
45949 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
45950 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45951 LDKEventHandler_JCalls_cloned(&event_handler_conv);
45953 LDKRetryAttempts retry_attempts_conv;
45954 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
45955 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
45956 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
45957 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
45958 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
45959 int64_t ret_ref = 0;
45960 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45961 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45962 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45963 ret_ref = (uintptr_t)ret_var.inner;
45964 if (ret_var.is_owned) {
45970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
45971 LDKInvoicePayer this_arg_conv;
45972 this_arg_conv.inner = (void*)(this_arg & (~1));
45973 this_arg_conv.is_owned = false;
45974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45975 LDKInvoice invoice_conv;
45976 invoice_conv.inner = (void*)(invoice & (~1));
45977 invoice_conv.is_owned = false;
45978 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45979 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45980 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
45981 return (int64_t)ret_conv;
45984 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) {
45985 LDKInvoicePayer this_arg_conv;
45986 this_arg_conv.inner = (void*)(this_arg & (~1));
45987 this_arg_conv.is_owned = false;
45988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45989 LDKInvoice invoice_conv;
45990 invoice_conv.inner = (void*)(invoice & (~1));
45991 invoice_conv.is_owned = false;
45992 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45993 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45994 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
45995 return (int64_t)ret_conv;
45998 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) {
45999 LDKInvoicePayer this_arg_conv;
46000 this_arg_conv.inner = (void*)(this_arg & (~1));
46001 this_arg_conv.is_owned = false;
46002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46003 LDKPublicKey pubkey_ref;
46004 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
46005 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
46006 LDKThirtyTwoBytes payment_preimage_ref;
46007 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
46008 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
46009 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
46010 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
46011 return (int64_t)ret_conv;
46014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
46015 LDKInvoicePayer this_arg_conv;
46016 this_arg_conv.inner = (void*)(this_arg & (~1));
46017 this_arg_conv.is_owned = false;
46018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46019 unsigned char payment_hash_arr[32];
46020 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
46021 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
46022 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
46023 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
46026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
46027 LDKInvoicePayer this_arg_conv;
46028 this_arg_conv.inner = (void*)(this_arg & (~1));
46029 this_arg_conv.is_owned = false;
46030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46031 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
46032 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
46033 return (int64_t)ret_ret;
46036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JNIEnv *env, jclass clz, int64_t amt_msat, jstring description, int8_tArray payment_hash, int8_tArray payment_secret, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) {
46037 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46038 CHECK_ACCESS(amt_msat_ptr);
46039 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46040 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46041 LDKStr description_conv = java_to_owned_str(env, description);
46042 LDKThirtyTwoBytes payment_hash_ref;
46043 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
46044 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
46045 LDKThirtyTwoBytes payment_secret_ref;
46046 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
46047 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
46048 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
46049 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
46050 if (phantom_route_hints_constr.datalen > 0)
46051 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
46053 phantom_route_hints_constr.data = NULL;
46054 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
46055 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
46056 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
46057 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
46058 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
46059 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
46060 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
46061 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
46062 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
46064 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
46065 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46066 CHECK_ACCESS(keys_manager_ptr);
46067 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46068 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46069 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46070 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46072 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46073 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46074 *ret_conv = create_phantom_invoice(amt_msat_conv, description_conv, payment_hash_ref, payment_secret_ref, phantom_route_hints_constr, keys_manager_conv, network_conv);
46075 return (int64_t)ret_conv;
46078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int64_t description_hash, int8_tArray payment_hash, int8_tArray payment_secret, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) {
46079 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46080 CHECK_ACCESS(amt_msat_ptr);
46081 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46082 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46083 LDKSha256 description_hash_conv;
46084 description_hash_conv.inner = (void*)(description_hash & (~1));
46085 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
46086 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
46087 description_hash_conv = Sha256_clone(&description_hash_conv);
46088 LDKThirtyTwoBytes payment_hash_ref;
46089 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
46090 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
46091 LDKThirtyTwoBytes payment_secret_ref;
46092 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
46093 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
46094 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
46095 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
46096 if (phantom_route_hints_constr.datalen > 0)
46097 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
46099 phantom_route_hints_constr.data = NULL;
46100 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
46101 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
46102 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
46103 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
46104 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
46105 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
46106 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
46107 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
46108 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
46110 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
46111 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46112 CHECK_ACCESS(keys_manager_ptr);
46113 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46114 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46115 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46116 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46118 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46119 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46120 *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, description_hash_conv, payment_hash_ref, payment_secret_ref, phantom_route_hints_constr, keys_manager_conv, network_conv);
46121 return (int64_t)ret_conv;
46124 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) {
46125 LDKChannelManager channelmanager_conv;
46126 channelmanager_conv.inner = (void*)(channelmanager & (~1));
46127 channelmanager_conv.is_owned = false;
46128 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46129 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46130 CHECK_ACCESS(keys_manager_ptr);
46131 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46132 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46133 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46134 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46136 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46137 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46138 CHECK_ACCESS(amt_msat_ptr);
46139 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46140 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46141 LDKStr description_conv = java_to_owned_str(env, description);
46142 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46143 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
46144 return (int64_t)ret_conv;
46147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, int64_t description_hash) {
46148 LDKChannelManager channelmanager_conv;
46149 channelmanager_conv.inner = (void*)(channelmanager & (~1));
46150 channelmanager_conv.is_owned = false;
46151 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46152 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46153 CHECK_ACCESS(keys_manager_ptr);
46154 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46155 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46156 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46157 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46159 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46160 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46161 CHECK_ACCESS(amt_msat_ptr);
46162 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46163 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46164 LDKSha256 description_hash_conv;
46165 description_hash_conv.inner = (void*)(description_hash & (~1));
46166 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
46167 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
46168 description_hash_conv = Sha256_clone(&description_hash_conv);
46169 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46170 *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv);
46171 return (int64_t)ret_conv;
46174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch) {
46175 LDKChannelManager channelmanager_conv;
46176 channelmanager_conv.inner = (void*)(channelmanager & (~1));
46177 channelmanager_conv.is_owned = false;
46178 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46179 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46180 CHECK_ACCESS(keys_manager_ptr);
46181 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46182 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46183 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46184 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46186 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46187 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46188 CHECK_ACCESS(amt_msat_ptr);
46189 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46190 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46191 LDKSha256 description_hash_conv;
46192 description_hash_conv.inner = (void*)(description_hash & (~1));
46193 description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0);
46194 CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
46195 description_hash_conv = Sha256_clone(&description_hash_conv);
46196 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46197 *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch);
46198 return (int64_t)ret_conv;
46201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch) {
46202 LDKChannelManager channelmanager_conv;
46203 channelmanager_conv.inner = (void*)(channelmanager & (~1));
46204 channelmanager_conv.is_owned = false;
46205 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46206 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
46207 CHECK_ACCESS(keys_manager_ptr);
46208 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46209 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46210 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46211 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46213 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
46214 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
46215 CHECK_ACCESS(amt_msat_ptr);
46216 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46217 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
46218 LDKStr description_conv = java_to_owned_str(env, description);
46219 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46220 *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch);
46221 return (int64_t)ret_conv;
46224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46225 LDKDefaultRouter this_obj_conv;
46226 this_obj_conv.inner = (void*)(this_obj & (~1));
46227 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
46228 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46229 DefaultRouter_free(this_obj_conv);
46232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes) {
46233 LDKNetworkGraph network_graph_conv;
46234 network_graph_conv.inner = (void*)(network_graph & (~1));
46235 network_graph_conv.is_owned = false;
46236 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46237 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
46238 CHECK_ACCESS(logger_ptr);
46239 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46240 if (logger_conv.free == LDKLogger_JCalls_free) {
46241 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46242 LDKLogger_JCalls_cloned(&logger_conv);
46244 LDKThirtyTwoBytes random_seed_bytes_ref;
46245 CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
46246 (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data);
46247 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref);
46248 int64_t ret_ref = 0;
46249 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
46250 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
46251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46252 ret_ref = (uintptr_t)ret_var.inner;
46253 if (ret_var.is_owned) {
46259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
46260 LDKDefaultRouter this_arg_conv;
46261 this_arg_conv.inner = (void*)(this_arg & (~1));
46262 this_arg_conv.is_owned = false;
46263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46264 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
46265 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
46266 return (int64_t)ret_ret;
46269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
46270 LDKChannelManager this_arg_conv;
46271 this_arg_conv.inner = (void*)(this_arg & (~1));
46272 this_arg_conv.is_owned = false;
46273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46274 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
46275 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
46276 return (int64_t)ret_ret;
46279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
46280 LDKStr s_conv = java_to_owned_str(env, s);
46281 LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
46282 *ret_conv = SiPrefix_from_str(s_conv);
46283 return (int64_t)ret_conv;
46286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
46287 LDKStr s_conv = java_to_owned_str(env, s);
46288 LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
46289 *ret_conv = Invoice_from_str(s_conv);
46290 return (int64_t)ret_conv;
46293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
46294 LDKStr s_conv = java_to_owned_str(env, s);
46295 LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
46296 *ret_conv = SignedRawInvoice_from_str(s_conv);
46297 return (int64_t)ret_conv;
46300 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46301 LDKParseError* o_conv = (LDKParseError*)o;
46302 LDKStr ret_str = ParseError_to_str(o_conv);
46303 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46308 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46309 LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o;
46310 LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
46311 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46316 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46318 o_conv.inner = (void*)(o & (~1));
46319 o_conv.is_owned = false;
46320 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46321 LDKStr ret_str = Invoice_to_str(&o_conv);
46322 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46327 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46328 LDKSignedRawInvoice o_conv;
46329 o_conv.inner = (void*)(o & (~1));
46330 o_conv.is_owned = false;
46331 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46332 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
46333 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46338 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46339 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
46340 LDKStr ret_str = Currency_to_str(o_conv);
46341 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
46346 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
46347 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
46348 LDKStr ret_str = SiPrefix_to_str(o_conv);
46349 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);