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 inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
875 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
876 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
879 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) {
880 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
881 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
882 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
883 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
884 CVec_u8Z_free(ret_var);
888 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) {
889 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
890 int64_t ret_val = TxOut_get_value(thing_conv);
894 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
895 CHECK(owner->result_ok);
896 return *owner->contents.result;
898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
899 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
900 CResult_NoneNoneZ_get_ok(owner_conv);
903 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
904 CHECK(!owner->result_ok);
905 return *owner->contents.err;
907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
908 LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)(owner & ~1);
909 CResult_NoneNoneZ_get_err(owner_conv);
912 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
913 CHECK(owner->result_ok);
914 return CounterpartyCommitmentSecrets_clone(&*owner->contents.result);
916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
917 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
918 LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
923 ret_ref = (uintptr_t)ret_var.inner;
924 if (ret_var.is_owned) {
930 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
931 CHECK(!owner->result_ok);
932 return DecodeError_clone(&*owner->contents.err);
934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
935 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(owner & ~1);
936 LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
938 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
941 ret_ref = (uintptr_t)ret_var.inner;
942 if (ret_var.is_owned) {
948 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
949 CHECK(owner->result_ok);
950 return *owner->contents.result;
952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
953 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
954 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
955 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes);
959 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
960 CHECK(!owner->result_ok);
961 return *owner->contents.err;
963 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
964 LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)(owner & ~1);
965 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_SecretKeyErrorZ_get_err(owner_conv));
969 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
970 CHECK(owner->result_ok);
971 return *owner->contents.result;
973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
974 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
975 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
976 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form);
980 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
981 CHECK(!owner->result_ok);
982 return *owner->contents.err;
984 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
985 LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)(owner & ~1);
986 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeyErrorZ_get_err(owner_conv));
990 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
991 CHECK(owner->result_ok);
992 return TxCreationKeys_clone(&*owner->contents.result);
994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
995 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
996 LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1001 ret_ref = (uintptr_t)ret_var.inner;
1002 if (ret_var.is_owned) {
1008 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1009 CHECK(!owner->result_ok);
1010 return DecodeError_clone(&*owner->contents.err);
1012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1013 LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(owner & ~1);
1014 LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1015 int64_t ret_ref = 0;
1016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1019 ret_ref = (uintptr_t)ret_var.inner;
1020 if (ret_var.is_owned) {
1026 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1027 CHECK(owner->result_ok);
1028 return ChannelPublicKeys_clone(&*owner->contents.result);
1030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1031 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1032 LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1033 int64_t ret_ref = 0;
1034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1037 ret_ref = (uintptr_t)ret_var.inner;
1038 if (ret_var.is_owned) {
1044 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1045 CHECK(!owner->result_ok);
1046 return DecodeError_clone(&*owner->contents.err);
1048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1049 LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(owner & ~1);
1050 LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1051 int64_t ret_ref = 0;
1052 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1053 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1054 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1055 ret_ref = (uintptr_t)ret_var.inner;
1056 if (ret_var.is_owned) {
1062 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1063 CHECK(owner->result_ok);
1064 return TxCreationKeys_clone(&*owner->contents.result);
1066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1067 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1068 LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
1069 int64_t ret_ref = 0;
1070 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1071 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1072 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1073 ret_ref = (uintptr_t)ret_var.inner;
1074 if (ret_var.is_owned) {
1080 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
1081 CHECK(!owner->result_ok);
1082 return *owner->contents.err;
1084 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1085 LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)(owner & ~1);
1086 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_TxCreationKeysErrorZ_get_err(owner_conv));
1090 static jclass LDKCOption_u32Z_Some_class = NULL;
1091 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
1092 static jclass LDKCOption_u32Z_None_class = NULL;
1093 static jmethodID LDKCOption_u32Z_None_meth = NULL;
1094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
1095 LDKCOption_u32Z_Some_class =
1096 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
1097 CHECK(LDKCOption_u32Z_Some_class != NULL);
1098 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
1099 CHECK(LDKCOption_u32Z_Some_meth != NULL);
1100 LDKCOption_u32Z_None_class =
1101 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
1102 CHECK(LDKCOption_u32Z_None_class != NULL);
1103 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
1104 CHECK(LDKCOption_u32Z_None_meth != NULL);
1106 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1107 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
1109 case LDKCOption_u32Z_Some: {
1110 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
1112 case LDKCOption_u32Z_None: {
1113 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
1118 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1119 CHECK(owner->result_ok);
1120 return HTLCOutputInCommitment_clone(&*owner->contents.result);
1122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1123 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1124 LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1125 int64_t ret_ref = 0;
1126 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1127 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1129 ret_ref = (uintptr_t)ret_var.inner;
1130 if (ret_var.is_owned) {
1136 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1137 CHECK(!owner->result_ok);
1138 return DecodeError_clone(&*owner->contents.err);
1140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1141 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(owner & ~1);
1142 LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1143 int64_t ret_ref = 0;
1144 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1145 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1147 ret_ref = (uintptr_t)ret_var.inner;
1148 if (ret_var.is_owned) {
1154 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1155 CHECK(owner->result_ok);
1156 return CounterpartyChannelTransactionParameters_clone(&*owner->contents.result);
1158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1159 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1160 LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1161 int64_t ret_ref = 0;
1162 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1163 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1165 ret_ref = (uintptr_t)ret_var.inner;
1166 if (ret_var.is_owned) {
1172 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1173 CHECK(!owner->result_ok);
1174 return DecodeError_clone(&*owner->contents.err);
1176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1177 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1178 LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1179 int64_t ret_ref = 0;
1180 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1181 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1182 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1183 ret_ref = (uintptr_t)ret_var.inner;
1184 if (ret_var.is_owned) {
1190 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1191 CHECK(owner->result_ok);
1192 return ChannelTransactionParameters_clone(&*owner->contents.result);
1194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1195 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1196 LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1197 int64_t ret_ref = 0;
1198 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1199 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1200 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1201 ret_ref = (uintptr_t)ret_var.inner;
1202 if (ret_var.is_owned) {
1208 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1209 CHECK(!owner->result_ok);
1210 return DecodeError_clone(&*owner->contents.err);
1212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1213 LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(owner & ~1);
1214 LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1215 int64_t ret_ref = 0;
1216 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1217 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1218 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1219 ret_ref = (uintptr_t)ret_var.inner;
1220 if (ret_var.is_owned) {
1226 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1227 CHECK(owner->result_ok);
1228 return HolderCommitmentTransaction_clone(&*owner->contents.result);
1230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1231 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1232 LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1233 int64_t ret_ref = 0;
1234 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1235 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1236 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1237 ret_ref = (uintptr_t)ret_var.inner;
1238 if (ret_var.is_owned) {
1244 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1245 CHECK(!owner->result_ok);
1246 return DecodeError_clone(&*owner->contents.err);
1248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1249 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1250 LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1251 int64_t ret_ref = 0;
1252 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1253 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1254 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1255 ret_ref = (uintptr_t)ret_var.inner;
1256 if (ret_var.is_owned) {
1262 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1263 CHECK(owner->result_ok);
1264 return BuiltCommitmentTransaction_clone(&*owner->contents.result);
1266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1267 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1268 LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1269 int64_t ret_ref = 0;
1270 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1271 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1272 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1273 ret_ref = (uintptr_t)ret_var.inner;
1274 if (ret_var.is_owned) {
1280 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1281 CHECK(!owner->result_ok);
1282 return DecodeError_clone(&*owner->contents.err);
1284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1285 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(owner & ~1);
1286 LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1287 int64_t ret_ref = 0;
1288 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1289 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1290 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1291 ret_ref = (uintptr_t)ret_var.inner;
1292 if (ret_var.is_owned) {
1298 static inline struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1299 CHECK(owner->result_ok);
1300 return &*owner->contents.result;
1302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1303 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1304 LDKTrustedClosingTransaction ret_var = *CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1305 int64_t ret_ref = 0;
1306 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1307 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1308 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1309 ret_ref = (uintptr_t)ret_var.inner & ~1;
1313 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1314 CHECK(!owner->result_ok);
1315 return *owner->contents.err;
1317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1318 LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(owner & ~1);
1319 CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1322 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1323 CHECK(owner->result_ok);
1324 return CommitmentTransaction_clone(&*owner->contents.result);
1326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1327 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1328 LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1329 int64_t ret_ref = 0;
1330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1333 ret_ref = (uintptr_t)ret_var.inner;
1334 if (ret_var.is_owned) {
1340 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1341 CHECK(!owner->result_ok);
1342 return DecodeError_clone(&*owner->contents.err);
1344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1345 LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(owner & ~1);
1346 LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1347 int64_t ret_ref = 0;
1348 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1349 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1350 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1351 ret_ref = (uintptr_t)ret_var.inner;
1352 if (ret_var.is_owned) {
1358 static inline struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1359 CHECK(owner->result_ok);
1360 return &*owner->contents.result;
1362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1363 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1364 LDKTrustedCommitmentTransaction ret_var = *CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1365 int64_t ret_ref = 0;
1366 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1367 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1368 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1369 ret_ref = (uintptr_t)ret_var.inner & ~1;
1373 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1374 CHECK(!owner->result_ok);
1375 return *owner->contents.err;
1377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1378 LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(owner & ~1);
1379 CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1382 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1383 CHECK(owner->result_ok);
1384 return *owner->contents.result;
1386 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1387 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1388 LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1389 jobjectArray ret_arr = NULL;
1390 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
1392 for (size_t i = 0; i < ret_var.datalen; i++) {
1393 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
1394 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
1395 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
1401 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1402 CHECK(!owner->result_ok);
1403 return *owner->contents.err;
1405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1406 LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)(owner & ~1);
1407 CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1410 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1411 CHECK(owner->result_ok);
1412 return ShutdownScript_clone(&*owner->contents.result);
1414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1415 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1416 LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1417 int64_t ret_ref = 0;
1418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1421 ret_ref = (uintptr_t)ret_var.inner;
1422 if (ret_var.is_owned) {
1428 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1429 CHECK(!owner->result_ok);
1430 return DecodeError_clone(&*owner->contents.err);
1432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1433 LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(owner & ~1);
1434 LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1435 int64_t ret_ref = 0;
1436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1439 ret_ref = (uintptr_t)ret_var.inner;
1440 if (ret_var.is_owned) {
1446 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1447 CHECK(owner->result_ok);
1448 return ShutdownScript_clone(&*owner->contents.result);
1450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1451 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1452 LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1453 int64_t ret_ref = 0;
1454 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1455 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1457 ret_ref = (uintptr_t)ret_var.inner;
1458 if (ret_var.is_owned) {
1464 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1465 CHECK(!owner->result_ok);
1466 return InvalidShutdownScript_clone(&*owner->contents.err);
1468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1469 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(owner & ~1);
1470 LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1471 int64_t ret_ref = 0;
1472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1475 ret_ref = (uintptr_t)ret_var.inner;
1476 if (ret_var.is_owned) {
1482 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1483 CHECK(owner->result_ok);
1484 return *owner->contents.result;
1486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1487 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1488 CResult_NoneErrorZ_get_ok(owner_conv);
1491 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
1492 CHECK(!owner->result_ok);
1493 return *owner->contents.err;
1495 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1496 LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)(owner & ~1);
1497 jclass ret_conv = LDKIOError_to_java(env, CResult_NoneErrorZ_get_err(owner_conv));
1501 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1502 CHECK(owner->result_ok);
1503 return RouteHop_clone(&*owner->contents.result);
1505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1506 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1507 LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1508 int64_t ret_ref = 0;
1509 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1510 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1511 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1512 ret_ref = (uintptr_t)ret_var.inner;
1513 if (ret_var.is_owned) {
1519 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1520 CHECK(!owner->result_ok);
1521 return DecodeError_clone(&*owner->contents.err);
1523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1524 LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)(owner & ~1);
1525 LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1526 int64_t ret_ref = 0;
1527 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1528 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1529 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1530 ret_ref = (uintptr_t)ret_var.inner;
1531 if (ret_var.is_owned) {
1537 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1538 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1539 for (size_t i = 0; i < ret.datalen; i++) {
1540 ret.data[i] = RouteHop_clone(&orig->data[i]);
1544 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1545 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1546 for (size_t i = 0; i < ret.datalen; i++) {
1547 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1551 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1552 CHECK(owner->result_ok);
1553 return Route_clone(&*owner->contents.result);
1555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1556 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1557 LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1558 int64_t ret_ref = 0;
1559 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1560 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1561 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1562 ret_ref = (uintptr_t)ret_var.inner;
1563 if (ret_var.is_owned) {
1569 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1570 CHECK(!owner->result_ok);
1571 return DecodeError_clone(&*owner->contents.err);
1573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1574 LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)(owner & ~1);
1575 LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1576 int64_t ret_ref = 0;
1577 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1578 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1579 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1580 ret_ref = (uintptr_t)ret_var.inner;
1581 if (ret_var.is_owned) {
1587 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1588 CHECK(owner->result_ok);
1589 return RouteParameters_clone(&*owner->contents.result);
1591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1592 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1593 LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1594 int64_t ret_ref = 0;
1595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1598 ret_ref = (uintptr_t)ret_var.inner;
1599 if (ret_var.is_owned) {
1605 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1606 CHECK(!owner->result_ok);
1607 return DecodeError_clone(&*owner->contents.err);
1609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1610 LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(owner & ~1);
1611 LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1612 int64_t ret_ref = 0;
1613 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1614 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1615 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1616 ret_ref = (uintptr_t)ret_var.inner;
1617 if (ret_var.is_owned) {
1623 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1624 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1625 for (size_t i = 0; i < ret.datalen; i++) {
1626 ret.data[i] = RouteHint_clone(&orig->data[i]);
1630 static jclass LDKCOption_u64Z_Some_class = NULL;
1631 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1632 static jclass LDKCOption_u64Z_None_class = NULL;
1633 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1635 LDKCOption_u64Z_Some_class =
1636 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1637 CHECK(LDKCOption_u64Z_Some_class != NULL);
1638 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1639 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1640 LDKCOption_u64Z_None_class =
1641 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1642 CHECK(LDKCOption_u64Z_None_class != NULL);
1643 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1644 CHECK(LDKCOption_u64Z_None_meth != NULL);
1646 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1647 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1649 case LDKCOption_u64Z_Some: {
1650 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1652 case LDKCOption_u64Z_None: {
1653 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1658 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1659 CHECK(owner->result_ok);
1660 return PaymentParameters_clone(&*owner->contents.result);
1662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1663 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1664 LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1665 int64_t ret_ref = 0;
1666 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1667 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1668 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1669 ret_ref = (uintptr_t)ret_var.inner;
1670 if (ret_var.is_owned) {
1676 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1677 CHECK(!owner->result_ok);
1678 return DecodeError_clone(&*owner->contents.err);
1680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1681 LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(owner & ~1);
1682 LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1683 int64_t ret_ref = 0;
1684 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1685 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1686 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1687 ret_ref = (uintptr_t)ret_var.inner;
1688 if (ret_var.is_owned) {
1694 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1695 LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1696 for (size_t i = 0; i < ret.datalen; i++) {
1697 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1701 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1702 CHECK(owner->result_ok);
1703 return RouteHint_clone(&*owner->contents.result);
1705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1706 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1707 LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1708 int64_t ret_ref = 0;
1709 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1710 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1711 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1712 ret_ref = (uintptr_t)ret_var.inner;
1713 if (ret_var.is_owned) {
1719 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1720 CHECK(!owner->result_ok);
1721 return DecodeError_clone(&*owner->contents.err);
1723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1724 LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)(owner & ~1);
1725 LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1726 int64_t ret_ref = 0;
1727 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1728 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1729 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1730 ret_ref = (uintptr_t)ret_var.inner;
1731 if (ret_var.is_owned) {
1737 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1738 CHECK(owner->result_ok);
1739 return RouteHintHop_clone(&*owner->contents.result);
1741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1742 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1743 LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1744 int64_t ret_ref = 0;
1745 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1746 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1747 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1748 ret_ref = (uintptr_t)ret_var.inner;
1749 if (ret_var.is_owned) {
1755 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1756 CHECK(!owner->result_ok);
1757 return DecodeError_clone(&*owner->contents.err);
1759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1760 LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(owner & ~1);
1761 LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1762 int64_t ret_ref = 0;
1763 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1764 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1765 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1766 ret_ref = (uintptr_t)ret_var.inner;
1767 if (ret_var.is_owned) {
1773 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1774 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1775 for (size_t i = 0; i < ret.datalen; i++) {
1776 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1780 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1781 CHECK(owner->result_ok);
1782 return Route_clone(&*owner->contents.result);
1784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1785 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1786 LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1787 int64_t ret_ref = 0;
1788 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1789 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1790 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1791 ret_ref = (uintptr_t)ret_var.inner;
1792 if (ret_var.is_owned) {
1798 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1799 CHECK(!owner->result_ok);
1800 return LightningError_clone(&*owner->contents.err);
1802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1803 LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)(owner & ~1);
1804 LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1805 int64_t ret_ref = 0;
1806 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1807 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1808 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1809 ret_ref = (uintptr_t)ret_var.inner;
1810 if (ret_var.is_owned) {
1816 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1817 CHECK(owner->result_ok);
1818 return TxOut_clone(&*owner->contents.result);
1820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1821 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1822 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1823 *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
1824 return (int64_t)ret_ref;
1827 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
1828 CHECK(!owner->result_ok);
1829 return AccessError_clone(&*owner->contents.err);
1831 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1832 LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)(owner & ~1);
1833 jclass ret_conv = LDKAccessError_to_java(env, CResult_TxOutAccessErrorZ_get_err(owner_conv));
1837 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
1841 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1842 int64_t ret_val = C2Tuple_usizeTransactionZ_get_a(owner_conv);
1846 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
1849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
1850 LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)(owner & ~1);
1851 LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
1852 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
1853 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
1857 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1858 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1859 for (size_t i = 0; i < ret.datalen; i++) {
1860 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1864 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
1865 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1866 for (size_t i = 0; i < ret.datalen; i++) {
1867 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1871 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1872 CHECK(owner->result_ok);
1873 return *owner->contents.result;
1875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1876 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1877 CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
1880 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
1881 CHECK(!owner->result_ok);
1882 return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
1884 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1885 LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(owner & ~1);
1886 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
1890 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1891 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1892 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1893 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1894 static jclass LDKMonitorEvent_UpdateCompleted_class = NULL;
1895 static jmethodID LDKMonitorEvent_UpdateCompleted_meth = NULL;
1896 static jclass LDKMonitorEvent_UpdateFailed_class = NULL;
1897 static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL;
1898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1899 LDKMonitorEvent_HTLCEvent_class =
1900 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
1901 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1902 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1903 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1904 LDKMonitorEvent_CommitmentTxConfirmed_class =
1905 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed"));
1906 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1907 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1908 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1909 LDKMonitorEvent_UpdateCompleted_class =
1910 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted"));
1911 CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL);
1912 LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "<init>", "(JJ)V");
1913 CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL);
1914 LDKMonitorEvent_UpdateFailed_class =
1915 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed"));
1916 CHECK(LDKMonitorEvent_UpdateFailed_class != NULL);
1917 LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "<init>", "(J)V");
1918 CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL);
1920 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1921 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1923 case LDKMonitorEvent_HTLCEvent: {
1924 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1925 int64_t htlc_event_ref = 0;
1926 CHECK((((uintptr_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1927 CHECK((((uintptr_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1928 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
1929 htlc_event_ref = (uintptr_t)htlc_event_var.inner & ~1;
1930 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1932 case LDKMonitorEvent_CommitmentTxConfirmed: {
1933 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1934 int64_t commitment_tx_confirmed_ref = 0;
1935 CHECK((((uintptr_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1936 CHECK((((uintptr_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1937 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
1938 commitment_tx_confirmed_ref = (uintptr_t)commitment_tx_confirmed_var.inner & ~1;
1939 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
1941 case LDKMonitorEvent_UpdateCompleted: {
1942 LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
1943 int64_t funding_txo_ref = 0;
1944 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1945 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1946 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
1947 funding_txo_ref = (uintptr_t)funding_txo_var.inner & ~1;
1948 return (*env)->NewObject(env, LDKMonitorEvent_UpdateCompleted_class, LDKMonitorEvent_UpdateCompleted_meth, funding_txo_ref, obj->update_completed.monitor_update_id);
1950 case LDKMonitorEvent_UpdateFailed: {
1951 LDKOutPoint update_failed_var = obj->update_failed;
1952 int64_t update_failed_ref = 0;
1953 CHECK((((uintptr_t)update_failed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1954 CHECK((((uintptr_t)&update_failed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1955 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
1956 update_failed_ref = (uintptr_t)update_failed_var.inner & ~1;
1957 return (*env)->NewObject(env, LDKMonitorEvent_UpdateFailed_class, LDKMonitorEvent_UpdateFailed_meth, update_failed_ref);
1962 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1963 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1964 for (size_t i = 0; i < ret.datalen; i++) {
1965 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1969 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1970 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1971 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1972 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1974 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1975 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some"));
1976 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1977 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1978 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1979 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1980 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None"));
1981 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1982 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1983 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1985 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1986 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1988 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1989 LDKC2Tuple_usizeTransactionZ* some_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1990 *some_conv = obj->some;
1991 *some_conv = C2Tuple_usizeTransactionZ_clone(some_conv);
1992 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, ((int64_t)some_conv));
1994 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1995 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
2000 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
2001 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
2002 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
2003 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
2004 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
2005 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
2006 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
2007 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
2008 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
2009 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
2010 static jclass LDKClosureReason_ProcessingError_class = NULL;
2011 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
2012 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
2013 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
2014 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
2015 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
2016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
2017 LDKClosureReason_CounterpartyForceClosed_class =
2018 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
2019 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
2020 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
2021 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
2022 LDKClosureReason_HolderForceClosed_class =
2023 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
2024 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
2025 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
2026 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
2027 LDKClosureReason_CooperativeClosure_class =
2028 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure"));
2029 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
2030 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
2031 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
2032 LDKClosureReason_CommitmentTxConfirmed_class =
2033 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
2034 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
2035 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
2036 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
2037 LDKClosureReason_FundingTimedOut_class =
2038 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
2039 CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
2040 LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
2041 CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
2042 LDKClosureReason_ProcessingError_class =
2043 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
2044 CHECK(LDKClosureReason_ProcessingError_class != NULL);
2045 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
2046 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
2047 LDKClosureReason_DisconnectedPeer_class =
2048 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
2049 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
2050 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
2051 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
2052 LDKClosureReason_OutdatedChannelManager_class =
2053 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
2054 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
2055 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
2056 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
2058 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2059 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
2061 case LDKClosureReason_CounterpartyForceClosed: {
2062 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
2063 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
2064 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
2066 case LDKClosureReason_HolderForceClosed: {
2067 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
2069 case LDKClosureReason_CooperativeClosure: {
2070 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
2072 case LDKClosureReason_CommitmentTxConfirmed: {
2073 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
2075 case LDKClosureReason_FundingTimedOut: {
2076 return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
2078 case LDKClosureReason_ProcessingError: {
2079 LDKStr err_str = obj->processing_error.err;
2080 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2081 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
2083 case LDKClosureReason_DisconnectedPeer: {
2084 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
2086 case LDKClosureReason_OutdatedChannelManager: {
2087 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
2092 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
2093 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
2094 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
2095 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
2096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
2097 LDKCOption_ClosureReasonZ_Some_class =
2098 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
2099 CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
2100 LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
2101 CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
2102 LDKCOption_ClosureReasonZ_None_class =
2103 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
2104 CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
2105 LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
2106 CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
2108 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2109 LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)(ptr & ~1);
2111 case LDKCOption_ClosureReasonZ_Some: {
2112 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2113 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
2115 case LDKCOption_ClosureReasonZ_None: {
2116 return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
2121 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2122 CHECK(owner->result_ok);
2123 return COption_ClosureReasonZ_clone(&*owner->contents.result);
2125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2126 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2127 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
2128 *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
2129 int64_t ret_ref = (uintptr_t)ret_copy;
2133 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
2134 CHECK(!owner->result_ok);
2135 return DecodeError_clone(&*owner->contents.err);
2137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2138 LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(owner & ~1);
2139 LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
2140 int64_t ret_ref = 0;
2141 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2142 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2143 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2144 ret_ref = (uintptr_t)ret_var.inner;
2145 if (ret_var.is_owned) {
2151 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
2152 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
2153 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
2154 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
2155 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
2156 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
2157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
2158 LDKNetworkUpdate_ChannelUpdateMessage_class =
2159 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
2160 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
2161 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
2162 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
2163 LDKNetworkUpdate_ChannelClosed_class =
2164 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed"));
2165 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
2166 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
2167 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
2168 LDKNetworkUpdate_NodeFailure_class =
2169 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
2170 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
2171 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
2172 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
2174 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2175 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
2177 case LDKNetworkUpdate_ChannelUpdateMessage: {
2178 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
2179 int64_t msg_ref = 0;
2180 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2181 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2182 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2183 msg_ref = (uintptr_t)msg_var.inner & ~1;
2184 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
2186 case LDKNetworkUpdate_ChannelClosed: {
2187 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
2189 case LDKNetworkUpdate_NodeFailure: {
2190 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2191 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
2192 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
2197 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
2198 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
2199 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
2200 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
2201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
2202 LDKCOption_NetworkUpdateZ_Some_class =
2203 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
2204 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
2205 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
2206 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
2207 LDKCOption_NetworkUpdateZ_None_class =
2208 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
2209 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
2210 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
2211 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
2213 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2214 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
2216 case LDKCOption_NetworkUpdateZ_Some: {
2217 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2218 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
2220 case LDKCOption_NetworkUpdateZ_None: {
2221 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
2226 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2227 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2228 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2229 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2230 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2231 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2233 LDKSpendableOutputDescriptor_StaticOutput_class =
2234 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2235 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2236 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
2237 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2238 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2239 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2240 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2241 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2242 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2243 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2244 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2245 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2246 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2247 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2249 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2250 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
2252 case LDKSpendableOutputDescriptor_StaticOutput: {
2253 LDKOutPoint outpoint_var = obj->static_output.outpoint;
2254 int64_t outpoint_ref = 0;
2255 CHECK((((uintptr_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2256 CHECK((((uintptr_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2257 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2258 outpoint_ref = (uintptr_t)outpoint_var.inner & ~1;
2259 int64_t output_ref = ((uintptr_t)&obj->static_output.output) | 1;
2260 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (int64_t)output_ref);
2262 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2263 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2264 int64_t delayed_payment_output_ref = 0;
2265 CHECK((((uintptr_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2266 CHECK((((uintptr_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2267 CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2268 delayed_payment_output_ref = (uintptr_t)delayed_payment_output_var.inner & ~1;
2269 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2271 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2272 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2273 int64_t static_payment_output_ref = 0;
2274 CHECK((((uintptr_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2275 CHECK((((uintptr_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2276 CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2277 static_payment_output_ref = (uintptr_t)static_payment_output_var.inner & ~1;
2278 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2283 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2284 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2285 for (size_t i = 0; i < ret.datalen; i++) {
2286 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2290 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
2291 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
2292 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
2293 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
2294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
2295 LDKPaymentPurpose_InvoicePayment_class =
2296 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment"));
2297 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
2298 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[B)V");
2299 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
2300 LDKPaymentPurpose_SpontaneousPayment_class =
2301 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
2302 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
2303 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
2304 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
2306 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2307 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
2309 case LDKPaymentPurpose_InvoicePayment: {
2310 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2311 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
2312 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
2313 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
2314 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr);
2316 case LDKPaymentPurpose_SpontaneousPayment: {
2317 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
2318 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
2319 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
2324 static jclass LDKEvent_FundingGenerationReady_class = NULL;
2325 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
2326 static jclass LDKEvent_PaymentReceived_class = NULL;
2327 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
2328 static jclass LDKEvent_PaymentSent_class = NULL;
2329 static jmethodID LDKEvent_PaymentSent_meth = NULL;
2330 static jclass LDKEvent_PaymentPathFailed_class = NULL;
2331 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
2332 static jclass LDKEvent_PaymentFailed_class = NULL;
2333 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
2334 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
2335 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
2336 static jclass LDKEvent_SpendableOutputs_class = NULL;
2337 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
2338 static jclass LDKEvent_PaymentForwarded_class = NULL;
2339 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
2340 static jclass LDKEvent_ChannelClosed_class = NULL;
2341 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
2342 static jclass LDKEvent_DiscardFunding_class = NULL;
2343 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
2344 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
2345 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
2346 static jclass LDKEvent_OpenChannelRequest_class = NULL;
2347 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
2348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
2349 LDKEvent_FundingGenerationReady_class =
2350 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
2351 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
2352 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
2353 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
2354 LDKEvent_PaymentReceived_class =
2355 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived"));
2356 CHECK(LDKEvent_PaymentReceived_class != NULL);
2357 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
2358 CHECK(LDKEvent_PaymentReceived_meth != NULL);
2359 LDKEvent_PaymentSent_class =
2360 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
2361 CHECK(LDKEvent_PaymentSent_class != NULL);
2362 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B[B[BJ)V");
2363 CHECK(LDKEvent_PaymentSent_meth != NULL);
2364 LDKEvent_PaymentPathFailed_class =
2365 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
2366 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
2367 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([B[BZJZ[JJJ)V");
2368 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
2369 LDKEvent_PaymentFailed_class =
2370 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
2371 CHECK(LDKEvent_PaymentFailed_class != NULL);
2372 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[B)V");
2373 CHECK(LDKEvent_PaymentFailed_meth != NULL);
2374 LDKEvent_PendingHTLCsForwardable_class =
2375 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
2376 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
2377 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
2378 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
2379 LDKEvent_SpendableOutputs_class =
2380 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
2381 CHECK(LDKEvent_SpendableOutputs_class != NULL);
2382 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
2383 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
2384 LDKEvent_PaymentForwarded_class =
2385 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
2386 CHECK(LDKEvent_PaymentForwarded_class != NULL);
2387 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
2388 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
2389 LDKEvent_ChannelClosed_class =
2390 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
2391 CHECK(LDKEvent_ChannelClosed_class != NULL);
2392 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJJ)V");
2393 CHECK(LDKEvent_ChannelClosed_meth != NULL);
2394 LDKEvent_DiscardFunding_class =
2395 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
2396 CHECK(LDKEvent_DiscardFunding_class != NULL);
2397 LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "([B[B)V");
2398 CHECK(LDKEvent_DiscardFunding_meth != NULL);
2399 LDKEvent_PaymentPathSuccessful_class =
2400 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
2401 CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
2402 LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([B[B[J)V");
2403 CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
2404 LDKEvent_OpenChannelRequest_class =
2405 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
2406 CHECK(LDKEvent_OpenChannelRequest_class != NULL);
2407 LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "([B[BJJ)V");
2408 CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
2410 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2411 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
2413 case LDKEvent_FundingGenerationReady: {
2414 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2415 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
2416 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
2417 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
2418 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
2419 return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_arr, obj->funding_generation_ready.user_channel_id);
2421 case LDKEvent_PaymentReceived: {
2422 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2423 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
2424 int64_t purpose_ref = ((uintptr_t)&obj->payment_received.purpose) | 1;
2425 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
2427 case LDKEvent_PaymentSent: {
2428 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2429 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_sent.payment_id.data);
2430 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
2431 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
2432 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2433 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
2434 int64_t fee_paid_msat_ref = ((uintptr_t)&obj->payment_sent.fee_paid_msat) | 1;
2435 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_arr, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
2437 case LDKEvent_PaymentPathFailed: {
2438 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2439 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_failed.payment_id.data);
2440 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2441 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
2442 int64_t network_update_ref = ((uintptr_t)&obj->payment_path_failed.network_update) | 1;
2443 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
2444 int64_tArray path_arr = NULL;
2445 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2446 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2447 for (size_t k = 0; k < path_var.datalen; k++) {
2448 LDKRouteHop path_conv_10_var = path_var.data[k];
2449 int64_t path_conv_10_ref = 0;
2450 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2451 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2452 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2453 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2454 path_arr_ptr[k] = path_conv_10_ref;
2456 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2457 int64_t short_channel_id_ref = ((uintptr_t)&obj->payment_path_failed.short_channel_id) | 1;
2458 LDKRouteParameters retry_var = obj->payment_path_failed.retry;
2459 int64_t retry_ref = 0;
2460 if ((uintptr_t)retry_var.inner > 4096) {
2461 CHECK((((uintptr_t)retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2462 CHECK((((uintptr_t)&retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2463 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
2464 retry_ref = (uintptr_t)retry_var.inner & ~1;
2466 return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr, short_channel_id_ref, retry_ref);
2468 case LDKEvent_PaymentFailed: {
2469 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2470 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
2471 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2472 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
2473 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr);
2475 case LDKEvent_PendingHTLCsForwardable: {
2476 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
2478 case LDKEvent_SpendableOutputs: {
2479 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
2480 int64_tArray outputs_arr = NULL;
2481 outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
2482 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
2483 for (size_t b = 0; b < outputs_var.datalen; b++) {
2484 int64_t outputs_conv_27_ref = ((uintptr_t)&outputs_var.data[b]) | 1;
2485 outputs_arr_ptr[b] = outputs_conv_27_ref;
2487 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
2488 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
2490 case LDKEvent_PaymentForwarded: {
2491 int64_t fee_earned_msat_ref = ((uintptr_t)&obj->payment_forwarded.fee_earned_msat) | 1;
2492 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
2494 case LDKEvent_ChannelClosed: {
2495 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2496 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
2497 int64_t reason_ref = ((uintptr_t)&obj->channel_closed.reason) | 1;
2498 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, obj->channel_closed.user_channel_id, reason_ref);
2500 case LDKEvent_DiscardFunding: {
2501 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
2502 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data);
2503 LDKTransaction transaction_var = obj->discard_funding.transaction;
2504 int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
2505 (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
2506 return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr);
2508 case LDKEvent_PaymentPathSuccessful: {
2509 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
2510 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
2511 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
2512 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data);
2513 LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
2514 int64_tArray path_arr = NULL;
2515 path_arr = (*env)->NewLongArray(env, path_var.datalen);
2516 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
2517 for (size_t k = 0; k < path_var.datalen; k++) {
2518 LDKRouteHop path_conv_10_var = path_var.data[k];
2519 int64_t path_conv_10_ref = 0;
2520 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2521 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2522 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
2523 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner & ~1;
2524 path_arr_ptr[k] = path_conv_10_ref;
2526 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
2527 return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr);
2529 case LDKEvent_OpenChannelRequest: {
2530 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
2531 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data);
2532 int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
2533 (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
2534 return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, obj->open_channel_request.funding_satoshis, obj->open_channel_request.push_msat);
2539 static jclass LDKCOption_EventZ_Some_class = NULL;
2540 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
2541 static jclass LDKCOption_EventZ_None_class = NULL;
2542 static jmethodID LDKCOption_EventZ_None_meth = NULL;
2543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
2544 LDKCOption_EventZ_Some_class =
2545 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
2546 CHECK(LDKCOption_EventZ_Some_class != NULL);
2547 LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
2548 CHECK(LDKCOption_EventZ_Some_meth != NULL);
2549 LDKCOption_EventZ_None_class =
2550 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
2551 CHECK(LDKCOption_EventZ_None_class != NULL);
2552 LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
2553 CHECK(LDKCOption_EventZ_None_meth != NULL);
2555 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2556 LDKCOption_EventZ *obj = (LDKCOption_EventZ*)(ptr & ~1);
2558 case LDKCOption_EventZ_Some: {
2559 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
2560 return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
2562 case LDKCOption_EventZ_None: {
2563 return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
2568 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2569 CHECK(owner->result_ok);
2570 return COption_EventZ_clone(&*owner->contents.result);
2572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2573 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2574 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2575 *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2576 int64_t ret_ref = (uintptr_t)ret_copy;
2580 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2581 CHECK(!owner->result_ok);
2582 return DecodeError_clone(&*owner->contents.err);
2584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2585 LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(owner & ~1);
2586 LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2587 int64_t ret_ref = 0;
2588 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2589 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2590 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2591 ret_ref = (uintptr_t)ret_var.inner;
2592 if (ret_var.is_owned) {
2598 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
2599 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
2600 static jclass LDKErrorAction_IgnoreError_class = NULL;
2601 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
2602 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
2603 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
2604 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
2605 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
2606 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
2607 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
2608 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
2609 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
2610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
2611 LDKErrorAction_DisconnectPeer_class =
2612 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
2613 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
2614 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
2615 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
2616 LDKErrorAction_IgnoreError_class =
2617 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
2618 CHECK(LDKErrorAction_IgnoreError_class != NULL);
2619 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
2620 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
2621 LDKErrorAction_IgnoreAndLog_class =
2622 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
2623 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
2624 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
2625 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
2626 LDKErrorAction_IgnoreDuplicateGossip_class =
2627 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
2628 CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
2629 LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
2630 CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
2631 LDKErrorAction_SendErrorMessage_class =
2632 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
2633 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
2634 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
2635 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
2636 LDKErrorAction_SendWarningMessage_class =
2637 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
2638 CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
2639 LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
2640 CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
2642 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2643 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
2645 case LDKErrorAction_DisconnectPeer: {
2646 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2647 int64_t msg_ref = 0;
2648 if ((uintptr_t)msg_var.inner > 4096) {
2649 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2650 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2651 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2652 msg_ref = (uintptr_t)msg_var.inner & ~1;
2654 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
2656 case LDKErrorAction_IgnoreError: {
2657 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
2659 case LDKErrorAction_IgnoreAndLog: {
2660 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
2661 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
2663 case LDKErrorAction_IgnoreDuplicateGossip: {
2664 return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
2666 case LDKErrorAction_SendErrorMessage: {
2667 LDKErrorMessage msg_var = obj->send_error_message.msg;
2668 int64_t msg_ref = 0;
2669 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2670 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2671 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2672 msg_ref = (uintptr_t)msg_var.inner & ~1;
2673 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
2675 case LDKErrorAction_SendWarningMessage: {
2676 LDKWarningMessage msg_var = obj->send_warning_message.msg;
2677 int64_t msg_ref = 0;
2678 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2679 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2680 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2681 msg_ref = (uintptr_t)msg_var.inner & ~1;
2682 jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
2683 return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
2688 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
2689 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
2690 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
2691 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
2692 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
2693 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
2694 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
2695 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
2696 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
2697 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
2698 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
2699 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
2700 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
2701 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
2702 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
2703 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
2704 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
2705 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
2706 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
2707 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
2708 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
2709 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
2710 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
2711 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
2712 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
2713 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
2714 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
2715 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
2716 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
2717 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
2718 static jclass LDKMessageSendEvent_HandleError_class = NULL;
2719 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
2720 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
2721 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
2722 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
2723 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
2724 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
2725 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
2726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
2727 LDKMessageSendEvent_SendAcceptChannel_class =
2728 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
2729 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
2730 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
2731 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
2732 LDKMessageSendEvent_SendOpenChannel_class =
2733 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
2734 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
2735 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
2736 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
2737 LDKMessageSendEvent_SendFundingCreated_class =
2738 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
2739 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
2740 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
2741 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
2742 LDKMessageSendEvent_SendFundingSigned_class =
2743 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
2744 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
2745 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
2746 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
2747 LDKMessageSendEvent_SendFundingLocked_class =
2748 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked"));
2749 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
2750 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
2751 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
2752 LDKMessageSendEvent_SendAnnouncementSignatures_class =
2753 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
2754 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
2755 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
2756 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
2757 LDKMessageSendEvent_UpdateHTLCs_class =
2758 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
2759 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
2760 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
2761 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
2762 LDKMessageSendEvent_SendRevokeAndACK_class =
2763 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
2764 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
2765 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
2766 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
2767 LDKMessageSendEvent_SendClosingSigned_class =
2768 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
2769 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
2770 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
2771 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
2772 LDKMessageSendEvent_SendShutdown_class =
2773 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
2774 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
2775 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
2776 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
2777 LDKMessageSendEvent_SendChannelReestablish_class =
2778 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
2779 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
2780 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
2781 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
2782 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
2783 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
2784 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
2785 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
2786 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
2787 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
2788 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
2789 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
2790 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
2791 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
2792 LDKMessageSendEvent_BroadcastChannelUpdate_class =
2793 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
2794 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
2795 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
2796 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
2797 LDKMessageSendEvent_SendChannelUpdate_class =
2798 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
2799 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
2800 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
2801 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
2802 LDKMessageSendEvent_HandleError_class =
2803 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
2804 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
2805 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
2806 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
2807 LDKMessageSendEvent_SendChannelRangeQuery_class =
2808 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
2809 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
2810 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
2811 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
2812 LDKMessageSendEvent_SendShortIdsQuery_class =
2813 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
2814 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
2815 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
2816 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
2817 LDKMessageSendEvent_SendReplyChannelRange_class =
2818 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
2819 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
2820 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
2821 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
2823 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2824 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
2826 case LDKMessageSendEvent_SendAcceptChannel: {
2827 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2828 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
2829 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2830 int64_t msg_ref = 0;
2831 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2832 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2833 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2834 msg_ref = (uintptr_t)msg_var.inner & ~1;
2835 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
2837 case LDKMessageSendEvent_SendOpenChannel: {
2838 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2839 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
2840 LDKOpenChannel msg_var = obj->send_open_channel.msg;
2841 int64_t msg_ref = 0;
2842 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2843 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2844 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2845 msg_ref = (uintptr_t)msg_var.inner & ~1;
2846 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
2848 case LDKMessageSendEvent_SendFundingCreated: {
2849 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2850 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
2851 LDKFundingCreated msg_var = obj->send_funding_created.msg;
2852 int64_t msg_ref = 0;
2853 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2854 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2855 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2856 msg_ref = (uintptr_t)msg_var.inner & ~1;
2857 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
2859 case LDKMessageSendEvent_SendFundingSigned: {
2860 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2861 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
2862 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2863 int64_t msg_ref = 0;
2864 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2865 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2866 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2867 msg_ref = (uintptr_t)msg_var.inner & ~1;
2868 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
2870 case LDKMessageSendEvent_SendFundingLocked: {
2871 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2872 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
2873 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
2874 int64_t msg_ref = 0;
2875 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2876 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2877 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2878 msg_ref = (uintptr_t)msg_var.inner & ~1;
2879 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
2881 case LDKMessageSendEvent_SendAnnouncementSignatures: {
2882 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2883 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
2884 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2885 int64_t msg_ref = 0;
2886 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2887 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2888 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2889 msg_ref = (uintptr_t)msg_var.inner & ~1;
2890 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
2892 case LDKMessageSendEvent_UpdateHTLCs: {
2893 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2894 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
2895 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2896 int64_t updates_ref = 0;
2897 CHECK((((uintptr_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2898 CHECK((((uintptr_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2899 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2900 updates_ref = (uintptr_t)updates_var.inner & ~1;
2901 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
2903 case LDKMessageSendEvent_SendRevokeAndACK: {
2904 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2905 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
2906 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2907 int64_t msg_ref = 0;
2908 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2909 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2910 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2911 msg_ref = (uintptr_t)msg_var.inner & ~1;
2912 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
2914 case LDKMessageSendEvent_SendClosingSigned: {
2915 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2916 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
2917 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2918 int64_t msg_ref = 0;
2919 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2920 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2921 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2922 msg_ref = (uintptr_t)msg_var.inner & ~1;
2923 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
2925 case LDKMessageSendEvent_SendShutdown: {
2926 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2927 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
2928 LDKShutdown msg_var = obj->send_shutdown.msg;
2929 int64_t msg_ref = 0;
2930 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2931 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2932 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2933 msg_ref = (uintptr_t)msg_var.inner & ~1;
2934 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
2936 case LDKMessageSendEvent_SendChannelReestablish: {
2937 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2938 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
2939 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2940 int64_t msg_ref = 0;
2941 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2942 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2943 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2944 msg_ref = (uintptr_t)msg_var.inner & ~1;
2945 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
2947 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
2948 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2949 int64_t msg_ref = 0;
2950 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2951 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2952 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2953 msg_ref = (uintptr_t)msg_var.inner & ~1;
2954 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2955 int64_t update_msg_ref = 0;
2956 CHECK((((uintptr_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2957 CHECK((((uintptr_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2958 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2959 update_msg_ref = (uintptr_t)update_msg_var.inner & ~1;
2960 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
2962 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
2963 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
2964 int64_t msg_ref = 0;
2965 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2966 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2967 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2968 msg_ref = (uintptr_t)msg_var.inner & ~1;
2969 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
2971 case LDKMessageSendEvent_BroadcastChannelUpdate: {
2972 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2973 int64_t msg_ref = 0;
2974 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2975 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2976 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2977 msg_ref = (uintptr_t)msg_var.inner & ~1;
2978 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
2980 case LDKMessageSendEvent_SendChannelUpdate: {
2981 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2982 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
2983 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2984 int64_t msg_ref = 0;
2985 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2986 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2987 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2988 msg_ref = (uintptr_t)msg_var.inner & ~1;
2989 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
2991 case LDKMessageSendEvent_HandleError: {
2992 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2993 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
2994 int64_t action_ref = ((uintptr_t)&obj->handle_error.action) | 1;
2995 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
2997 case LDKMessageSendEvent_SendChannelRangeQuery: {
2998 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
2999 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
3000 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
3001 int64_t msg_ref = 0;
3002 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3003 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3004 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3005 msg_ref = (uintptr_t)msg_var.inner & ~1;
3006 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
3008 case LDKMessageSendEvent_SendShortIdsQuery: {
3009 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3010 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
3011 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
3012 int64_t msg_ref = 0;
3013 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3014 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3015 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3016 msg_ref = (uintptr_t)msg_var.inner & ~1;
3017 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
3019 case LDKMessageSendEvent_SendReplyChannelRange: {
3020 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
3021 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
3022 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
3023 int64_t msg_ref = 0;
3024 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3025 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3026 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3027 msg_ref = (uintptr_t)msg_var.inner & ~1;
3028 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
3033 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
3034 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
3035 for (size_t i = 0; i < ret.datalen; i++) {
3036 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
3040 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3041 CHECK(owner->result_ok);
3042 return FixedPenaltyScorer_clone(&*owner->contents.result);
3044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3045 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3046 LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3047 int64_t ret_ref = 0;
3048 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3049 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3050 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3051 ret_ref = (uintptr_t)ret_var.inner;
3052 if (ret_var.is_owned) {
3058 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3059 CHECK(!owner->result_ok);
3060 return DecodeError_clone(&*owner->contents.err);
3062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3063 LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(owner & ~1);
3064 LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3065 int64_t ret_ref = 0;
3066 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3067 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3068 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3069 ret_ref = (uintptr_t)ret_var.inner;
3070 if (ret_var.is_owned) {
3076 static inline struct LDKScoringParameters CResult_ScoringParametersDecodeErrorZ_get_ok(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3077 CHECK(owner->result_ok);
3078 return ScoringParameters_clone(&*owner->contents.result);
3080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3081 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3082 LDKScoringParameters ret_var = CResult_ScoringParametersDecodeErrorZ_get_ok(owner_conv);
3083 int64_t ret_ref = 0;
3084 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3085 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3086 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3087 ret_ref = (uintptr_t)ret_var.inner;
3088 if (ret_var.is_owned) {
3094 static inline struct LDKDecodeError CResult_ScoringParametersDecodeErrorZ_get_err(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3095 CHECK(!owner->result_ok);
3096 return DecodeError_clone(&*owner->contents.err);
3098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3099 LDKCResult_ScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(owner & ~1);
3100 LDKDecodeError ret_var = CResult_ScoringParametersDecodeErrorZ_get_err(owner_conv);
3101 int64_t ret_ref = 0;
3102 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3103 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3105 ret_ref = (uintptr_t)ret_var.inner;
3106 if (ret_var.is_owned) {
3112 static inline struct LDKScorer *CResult_ScorerDecodeErrorZ_get_ok(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
3113 CHECK(owner->result_ok);
3114 return &*owner->contents.result;
3116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3117 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
3118 LDKScorer ret_var = *CResult_ScorerDecodeErrorZ_get_ok(owner_conv);
3119 int64_t ret_ref = 0;
3120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3123 ret_ref = (uintptr_t)ret_var.inner & ~1;
3127 static inline struct LDKDecodeError CResult_ScorerDecodeErrorZ_get_err(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner){
3128 CHECK(!owner->result_ok);
3129 return DecodeError_clone(&*owner->contents.err);
3131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3132 LDKCResult_ScorerDecodeErrorZ* owner_conv = (LDKCResult_ScorerDecodeErrorZ*)(owner & ~1);
3133 LDKDecodeError ret_var = CResult_ScorerDecodeErrorZ_get_err(owner_conv);
3134 int64_t ret_ref = 0;
3135 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3136 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3137 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3138 ret_ref = (uintptr_t)ret_var.inner;
3139 if (ret_var.is_owned) {
3145 static inline struct LDKProbabilisticScoringParameters CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3146 CHECK(owner->result_ok);
3147 return ProbabilisticScoringParameters_clone(&*owner->contents.result);
3149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3150 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1);
3151 LDKProbabilisticScoringParameters ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(owner_conv);
3152 int64_t ret_ref = 0;
3153 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3154 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3155 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3156 ret_ref = (uintptr_t)ret_var.inner;
3157 if (ret_var.is_owned) {
3163 static inline struct LDKDecodeError CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){
3164 CHECK(!owner->result_ok);
3165 return DecodeError_clone(&*owner->contents.err);
3167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3168 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1);
3169 LDKDecodeError ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(owner_conv);
3170 int64_t ret_ref = 0;
3171 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3172 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3173 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3174 ret_ref = (uintptr_t)ret_var.inner;
3175 if (ret_var.is_owned) {
3181 static inline struct LDKProbabilisticScoringParameters C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){
3182 return ProbabilisticScoringParameters_clone(&owner->a);
3184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3185 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1);
3186 LDKProbabilisticScoringParameters ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(owner_conv);
3187 int64_t ret_ref = 0;
3188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3191 ret_ref = (uintptr_t)ret_var.inner;
3192 if (ret_var.is_owned) {
3198 static inline struct LDKNetworkGraph C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){
3199 return NetworkGraph_clone(&owner->b);
3201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3202 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1);
3203 LDKNetworkGraph ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(owner_conv);
3204 int64_t ret_ref = 0;
3205 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3206 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3207 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3208 ret_ref = (uintptr_t)ret_var.inner;
3209 if (ret_var.is_owned) {
3215 static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3216 CHECK(owner->result_ok);
3217 return &*owner->contents.result;
3219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3220 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3221 LDKProbabilisticScorer ret_var = *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3222 int64_t ret_ref = 0;
3223 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3224 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3225 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3226 ret_ref = (uintptr_t)ret_var.inner & ~1;
3230 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3231 CHECK(!owner->result_ok);
3232 return DecodeError_clone(&*owner->contents.err);
3234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3235 LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(owner & ~1);
3236 LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3237 int64_t ret_ref = 0;
3238 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3239 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3241 ret_ref = (uintptr_t)ret_var.inner;
3242 if (ret_var.is_owned) {
3248 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3249 CHECK(owner->result_ok);
3250 return InitFeatures_clone(&*owner->contents.result);
3252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3253 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3254 LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3255 int64_t ret_ref = 0;
3256 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3257 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3258 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3259 ret_ref = (uintptr_t)ret_var.inner;
3260 if (ret_var.is_owned) {
3266 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3267 CHECK(!owner->result_ok);
3268 return DecodeError_clone(&*owner->contents.err);
3270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3271 LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(owner & ~1);
3272 LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3273 int64_t ret_ref = 0;
3274 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3275 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3277 ret_ref = (uintptr_t)ret_var.inner;
3278 if (ret_var.is_owned) {
3284 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3285 CHECK(owner->result_ok);
3286 return ChannelFeatures_clone(&*owner->contents.result);
3288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3289 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3290 LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3291 int64_t ret_ref = 0;
3292 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3293 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3294 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3295 ret_ref = (uintptr_t)ret_var.inner;
3296 if (ret_var.is_owned) {
3302 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3303 CHECK(!owner->result_ok);
3304 return DecodeError_clone(&*owner->contents.err);
3306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3307 LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(owner & ~1);
3308 LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3309 int64_t ret_ref = 0;
3310 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3311 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3313 ret_ref = (uintptr_t)ret_var.inner;
3314 if (ret_var.is_owned) {
3320 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3321 CHECK(owner->result_ok);
3322 return NodeFeatures_clone(&*owner->contents.result);
3324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3325 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3326 LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3327 int64_t ret_ref = 0;
3328 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3329 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3331 ret_ref = (uintptr_t)ret_var.inner;
3332 if (ret_var.is_owned) {
3338 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3339 CHECK(!owner->result_ok);
3340 return DecodeError_clone(&*owner->contents.err);
3342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3343 LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(owner & ~1);
3344 LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3345 int64_t ret_ref = 0;
3346 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3347 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3348 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3349 ret_ref = (uintptr_t)ret_var.inner;
3350 if (ret_var.is_owned) {
3356 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3357 CHECK(owner->result_ok);
3358 return InvoiceFeatures_clone(&*owner->contents.result);
3360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3361 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3362 LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3363 int64_t ret_ref = 0;
3364 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3365 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3366 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3367 ret_ref = (uintptr_t)ret_var.inner;
3368 if (ret_var.is_owned) {
3374 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3375 CHECK(!owner->result_ok);
3376 return DecodeError_clone(&*owner->contents.err);
3378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3379 LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(owner & ~1);
3380 LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3381 int64_t ret_ref = 0;
3382 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3383 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3384 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3385 ret_ref = (uintptr_t)ret_var.inner;
3386 if (ret_var.is_owned) {
3392 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3393 CHECK(owner->result_ok);
3394 return ChannelTypeFeatures_clone(&*owner->contents.result);
3396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3397 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3398 LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3399 int64_t ret_ref = 0;
3400 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3401 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3402 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3403 ret_ref = (uintptr_t)ret_var.inner;
3404 if (ret_var.is_owned) {
3410 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3411 CHECK(!owner->result_ok);
3412 return DecodeError_clone(&*owner->contents.err);
3414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3415 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(owner & ~1);
3416 LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3417 int64_t ret_ref = 0;
3418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3421 ret_ref = (uintptr_t)ret_var.inner;
3422 if (ret_var.is_owned) {
3428 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3429 CHECK(owner->result_ok);
3430 return DelayedPaymentOutputDescriptor_clone(&*owner->contents.result);
3432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3433 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3434 LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3435 int64_t ret_ref = 0;
3436 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3437 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3439 ret_ref = (uintptr_t)ret_var.inner;
3440 if (ret_var.is_owned) {
3446 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3447 CHECK(!owner->result_ok);
3448 return DecodeError_clone(&*owner->contents.err);
3450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3451 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3452 LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3453 int64_t ret_ref = 0;
3454 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3455 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3457 ret_ref = (uintptr_t)ret_var.inner;
3458 if (ret_var.is_owned) {
3464 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3465 CHECK(owner->result_ok);
3466 return StaticPaymentOutputDescriptor_clone(&*owner->contents.result);
3468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3469 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3470 LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3471 int64_t ret_ref = 0;
3472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3475 ret_ref = (uintptr_t)ret_var.inner;
3476 if (ret_var.is_owned) {
3482 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3483 CHECK(!owner->result_ok);
3484 return DecodeError_clone(&*owner->contents.err);
3486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3487 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(owner & ~1);
3488 LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3489 int64_t ret_ref = 0;
3490 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3491 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3492 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3493 ret_ref = (uintptr_t)ret_var.inner;
3494 if (ret_var.is_owned) {
3500 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3501 CHECK(owner->result_ok);
3502 return SpendableOutputDescriptor_clone(&*owner->contents.result);
3504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3505 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3506 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3507 *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3508 int64_t ret_ref = (uintptr_t)ret_copy;
3512 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3513 CHECK(!owner->result_ok);
3514 return DecodeError_clone(&*owner->contents.err);
3516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3517 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(owner & ~1);
3518 LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3519 int64_t ret_ref = 0;
3520 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3521 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3522 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3523 ret_ref = (uintptr_t)ret_var.inner;
3524 if (ret_var.is_owned) {
3530 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3531 LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3532 for (size_t i = 0; i < ret.datalen; i++) {
3533 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3537 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3541 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3542 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3543 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form);
3547 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3550 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3551 LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(owner & ~1);
3552 LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3553 jobjectArray ret_arr = NULL;
3554 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
3556 for (size_t i = 0; i < ret_var.datalen; i++) {
3557 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
3558 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
3559 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
3565 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3566 CHECK(owner->result_ok);
3567 return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3570 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3571 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3572 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3573 return ((int64_t)ret_conv);
3576 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3577 CHECK(!owner->result_ok);
3578 return *owner->contents.err;
3580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3581 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(owner & ~1);
3582 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3585 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3586 CHECK(owner->result_ok);
3587 return *owner->contents.result;
3589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3590 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3591 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3592 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form);
3596 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3597 CHECK(!owner->result_ok);
3598 return *owner->contents.err;
3600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3601 LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)(owner & ~1);
3602 CResult_SignatureNoneZ_get_err(owner_conv);
3605 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
3609 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3610 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3611 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form);
3615 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
3619 LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)(owner & ~1);
3620 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
3621 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form);
3625 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3626 CHECK(owner->result_ok);
3627 return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3630 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3631 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3632 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3633 return ((int64_t)ret_conv);
3636 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3637 CHECK(!owner->result_ok);
3638 return *owner->contents.err;
3640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3641 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(owner & ~1);
3642 CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3645 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3646 CHECK(owner->result_ok);
3647 return *owner->contents.result;
3649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3650 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3651 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3652 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes);
3656 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3657 CHECK(!owner->result_ok);
3658 return *owner->contents.err;
3660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3661 LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)(owner & ~1);
3662 CResult_SecretKeyNoneZ_get_err(owner_conv);
3665 typedef struct LDKBaseSign_JCalls {
3666 atomic_size_t refcnt;
3669 jmethodID get_per_commitment_point_meth;
3670 jmethodID release_commitment_secret_meth;
3671 jmethodID validate_holder_commitment_meth;
3672 jmethodID channel_keys_id_meth;
3673 jmethodID sign_counterparty_commitment_meth;
3674 jmethodID validate_counterparty_revocation_meth;
3675 jmethodID sign_holder_commitment_and_htlcs_meth;
3676 jmethodID sign_justice_revoked_output_meth;
3677 jmethodID sign_justice_revoked_htlc_meth;
3678 jmethodID sign_counterparty_htlc_transaction_meth;
3679 jmethodID sign_closing_transaction_meth;
3680 jmethodID sign_channel_announcement_meth;
3681 jmethodID ready_channel_meth;
3682 } LDKBaseSign_JCalls;
3683 static void LDKBaseSign_JCalls_free(void* this_arg) {
3684 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3685 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3687 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3688 if (get_jenv_res == JNI_EDETACHED) {
3689 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3691 DO_ASSERT(get_jenv_res == JNI_OK);
3693 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3694 if (get_jenv_res == JNI_EDETACHED) {
3695 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3700 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3701 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3703 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3704 if (get_jenv_res == JNI_EDETACHED) {
3705 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3707 DO_ASSERT(get_jenv_res == JNI_OK);
3709 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3711 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
3712 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3713 (*env)->ExceptionDescribe(env);
3714 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
3716 LDKPublicKey ret_ref;
3717 CHECK((*env)->GetArrayLength(env, ret) == 33);
3718 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3719 if (get_jenv_res == JNI_EDETACHED) {
3720 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3724 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3725 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3727 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3728 if (get_jenv_res == JNI_EDETACHED) {
3729 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3731 DO_ASSERT(get_jenv_res == JNI_OK);
3733 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3735 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
3736 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3737 (*env)->ExceptionDescribe(env);
3738 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
3740 LDKThirtyTwoBytes ret_ref;
3741 CHECK((*env)->GetArrayLength(env, ret) == 32);
3742 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3743 if (get_jenv_res == JNI_EDETACHED) {
3744 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3748 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3749 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3751 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3752 if (get_jenv_res == JNI_EDETACHED) {
3753 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3755 DO_ASSERT(get_jenv_res == JNI_OK);
3757 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3758 int64_t holder_tx_ref = 0;
3759 holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3760 CHECK((((uintptr_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3761 CHECK((((uintptr_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3762 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3763 holder_tx_ref = (uintptr_t)holder_tx_var.inner;
3764 if (holder_tx_var.is_owned) {
3767 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3768 jobjectArray preimages_arr = NULL;
3769 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
3771 for (size_t i = 0; i < preimages_var.datalen; i++) {
3772 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3773 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
3774 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
3777 FREE(preimages_var.data);
3778 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3780 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, preimages_arr);
3781 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3782 (*env)->ExceptionDescribe(env);
3783 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
3785 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3786 CHECK_ACCESS(ret_ptr);
3787 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3789 if (get_jenv_res == JNI_EDETACHED) {
3790 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3794 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3795 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3797 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3798 if (get_jenv_res == JNI_EDETACHED) {
3799 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3801 DO_ASSERT(get_jenv_res == JNI_OK);
3803 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3805 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
3806 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3807 (*env)->ExceptionDescribe(env);
3808 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
3810 LDKThirtyTwoBytes ret_ref;
3811 CHECK((*env)->GetArrayLength(env, ret) == 32);
3812 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3813 if (get_jenv_res == JNI_EDETACHED) {
3814 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3818 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3819 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3821 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3822 if (get_jenv_res == JNI_EDETACHED) {
3823 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3825 DO_ASSERT(get_jenv_res == JNI_OK);
3827 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3828 int64_t commitment_tx_ref = 0;
3829 commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3830 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3831 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3832 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3833 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3834 if (commitment_tx_var.is_owned) {
3835 commitment_tx_ref |= 1;
3837 LDKCVec_PaymentPreimageZ preimages_var = preimages;
3838 jobjectArray preimages_arr = NULL;
3839 preimages_arr = (*env)->NewObjectArray(env, preimages_var.datalen, arr_of_B_clz, NULL);
3841 for (size_t i = 0; i < preimages_var.datalen; i++) {
3842 int8_tArray preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3843 (*env)->SetByteArrayRegion(env, preimages_conv_8_arr, 0, 32, preimages_var.data[i].data);
3844 (*env)->SetObjectArrayElement(env, preimages_arr, i, preimages_conv_8_arr);
3847 FREE(preimages_var.data);
3848 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3850 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, preimages_arr);
3851 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3852 (*env)->ExceptionDescribe(env);
3853 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
3855 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3856 CHECK_ACCESS(ret_ptr);
3857 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3859 if (get_jenv_res == JNI_EDETACHED) {
3860 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3864 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3865 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3867 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3868 if (get_jenv_res == JNI_EDETACHED) {
3869 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3871 DO_ASSERT(get_jenv_res == JNI_OK);
3873 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
3874 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
3875 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3877 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
3878 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3879 (*env)->ExceptionDescribe(env);
3880 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
3882 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3883 CHECK_ACCESS(ret_ptr);
3884 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3886 if (get_jenv_res == JNI_EDETACHED) {
3887 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3891 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3892 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3894 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3895 if (get_jenv_res == JNI_EDETACHED) {
3896 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3898 DO_ASSERT(get_jenv_res == JNI_OK);
3900 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3901 int64_t commitment_tx_ref = 0;
3902 commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3903 CHECK((((uintptr_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3904 CHECK((((uintptr_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3905 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3906 commitment_tx_ref = (uintptr_t)commitment_tx_var.inner;
3907 if (commitment_tx_var.is_owned) {
3908 commitment_tx_ref |= 1;
3910 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3912 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
3913 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3914 (*env)->ExceptionDescribe(env);
3915 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
3917 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3918 CHECK_ACCESS(ret_ptr);
3919 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3921 if (get_jenv_res == JNI_EDETACHED) {
3922 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3926 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]) {
3927 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3929 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3930 if (get_jenv_res == JNI_EDETACHED) {
3931 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3933 DO_ASSERT(get_jenv_res == JNI_OK);
3935 LDKTransaction justice_tx_var = justice_tx;
3936 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3937 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3938 Transaction_free(justice_tx_var);
3939 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3940 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3941 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3943 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
3944 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3945 (*env)->ExceptionDescribe(env);
3946 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
3948 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3949 CHECK_ACCESS(ret_ptr);
3950 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3952 if (get_jenv_res == JNI_EDETACHED) {
3953 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3957 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) {
3958 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3960 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3961 if (get_jenv_res == JNI_EDETACHED) {
3962 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3964 DO_ASSERT(get_jenv_res == JNI_OK);
3966 LDKTransaction justice_tx_var = justice_tx;
3967 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3968 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3969 Transaction_free(justice_tx_var);
3970 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3971 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3972 LDKHTLCOutputInCommitment htlc_var = *htlc;
3973 int64_t htlc_ref = 0;
3974 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3975 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3976 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3977 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3978 htlc_ref = (uintptr_t)htlc_var.inner;
3979 if (htlc_var.is_owned) {
3982 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3984 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
3985 if (UNLIKELY((*env)->ExceptionCheck(env))) {
3986 (*env)->ExceptionDescribe(env);
3987 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
3989 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
3990 CHECK_ACCESS(ret_ptr);
3991 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3993 if (get_jenv_res == JNI_EDETACHED) {
3994 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3998 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) {
3999 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4001 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4002 if (get_jenv_res == JNI_EDETACHED) {
4003 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4005 DO_ASSERT(get_jenv_res == JNI_OK);
4007 LDKTransaction htlc_tx_var = htlc_tx;
4008 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
4009 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
4010 Transaction_free(htlc_tx_var);
4011 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
4012 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
4013 LDKHTLCOutputInCommitment htlc_var = *htlc;
4014 int64_t htlc_ref = 0;
4015 htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4016 CHECK((((uintptr_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4017 CHECK((((uintptr_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4018 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4019 htlc_ref = (uintptr_t)htlc_var.inner;
4020 if (htlc_var.is_owned) {
4023 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4025 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
4026 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4027 (*env)->ExceptionDescribe(env);
4028 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
4030 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4031 CHECK_ACCESS(ret_ptr);
4032 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4034 if (get_jenv_res == JNI_EDETACHED) {
4035 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4039 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4040 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4042 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4043 if (get_jenv_res == JNI_EDETACHED) {
4044 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4046 DO_ASSERT(get_jenv_res == JNI_OK);
4048 LDKClosingTransaction closing_tx_var = *closing_tx;
4049 int64_t closing_tx_ref = 0;
4050 closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4051 CHECK((((uintptr_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4052 CHECK((((uintptr_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4053 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4054 closing_tx_ref = (uintptr_t)closing_tx_var.inner;
4055 if (closing_tx_var.is_owned) {
4056 closing_tx_ref |= 1;
4058 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4060 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
4061 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4062 (*env)->ExceptionDescribe(env);
4063 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
4065 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4066 CHECK_ACCESS(ret_ptr);
4067 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4069 if (get_jenv_res == JNI_EDETACHED) {
4070 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4074 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4075 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4077 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4078 if (get_jenv_res == JNI_EDETACHED) {
4079 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4081 DO_ASSERT(get_jenv_res == JNI_OK);
4083 LDKUnsignedChannelAnnouncement msg_var = *msg;
4084 int64_t msg_ref = 0;
4085 msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4086 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4087 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4088 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4089 msg_ref = (uintptr_t)msg_var.inner;
4090 if (msg_var.is_owned) {
4093 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4095 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
4096 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4097 (*env)->ExceptionDescribe(env);
4098 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
4100 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
4101 CHECK_ACCESS(ret_ptr);
4102 LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4104 if (get_jenv_res == JNI_EDETACHED) {
4105 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4109 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4110 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4112 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4113 if (get_jenv_res == JNI_EDETACHED) {
4114 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4116 DO_ASSERT(get_jenv_res == JNI_OK);
4118 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4119 int64_t channel_parameters_ref = 0;
4120 channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4121 CHECK((((uintptr_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4122 CHECK((((uintptr_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4123 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4124 channel_parameters_ref = (uintptr_t)channel_parameters_var.inner;
4125 if (channel_parameters_var.is_owned) {
4126 channel_parameters_ref |= 1;
4128 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4130 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
4131 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4132 (*env)->ExceptionDescribe(env);
4133 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
4135 if (get_jenv_res == JNI_EDETACHED) {
4136 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4139 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4140 jclass c = (*env)->GetObjectClass(env, o);
4142 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4143 atomic_init(&calls->refcnt, 1);
4144 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4145 calls->o = (*env)->NewWeakGlobalRef(env, o);
4146 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
4147 CHECK(calls->get_per_commitment_point_meth != NULL);
4148 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
4149 CHECK(calls->release_commitment_secret_meth != NULL);
4150 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
4151 CHECK(calls->validate_holder_commitment_meth != NULL);
4152 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
4153 CHECK(calls->channel_keys_id_meth != NULL);
4154 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B)J");
4155 CHECK(calls->sign_counterparty_commitment_meth != NULL);
4156 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
4157 CHECK(calls->validate_counterparty_revocation_meth != NULL);
4158 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
4159 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
4160 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
4161 CHECK(calls->sign_justice_revoked_output_meth != NULL);
4162 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
4163 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
4164 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
4165 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
4166 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
4167 CHECK(calls->sign_closing_transaction_meth != NULL);
4168 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
4169 CHECK(calls->sign_channel_announcement_meth != NULL);
4170 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
4171 CHECK(calls->ready_channel_meth != NULL);
4173 LDKChannelPublicKeys pubkeys_conv;
4174 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4175 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4176 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4179 .this_arg = (void*) calls,
4180 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4181 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4182 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4183 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4184 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4185 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4186 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4187 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4188 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
4189 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
4190 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
4191 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
4192 .ready_channel = ready_channel_LDKBaseSign_jcall,
4193 .free = LDKBaseSign_JCalls_free,
4194 .pubkeys = pubkeys_conv,
4195 .set_pubkeys = NULL,
4199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
4200 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
4201 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
4202 return (uint64_t)res_ptr;
4204 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) {
4205 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4206 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4207 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4208 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4209 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
4213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
4214 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4215 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4216 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4217 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
4222 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) {
4223 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4224 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4225 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4226 LDKHolderCommitmentTransaction holder_tx_conv;
4227 holder_tx_conv.inner = (void*)(holder_tx & (~1));
4228 holder_tx_conv.is_owned = false;
4229 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4230 LDKCVec_PaymentPreimageZ preimages_constr;
4231 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4232 if (preimages_constr.datalen > 0)
4233 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4235 preimages_constr.data = NULL;
4236 for (size_t i = 0; i < preimages_constr.datalen; i++) {
4237 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4238 LDKThirtyTwoBytes preimages_conv_8_ref;
4239 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4240 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4241 preimages_constr.data[i] = preimages_conv_8_ref;
4243 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4244 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4245 return (int64_t)ret_conv;
4248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4249 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4250 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4251 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4252 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4253 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
4257 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) {
4258 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4259 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4260 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4261 LDKCommitmentTransaction commitment_tx_conv;
4262 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4263 commitment_tx_conv.is_owned = false;
4264 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4265 LDKCVec_PaymentPreimageZ preimages_constr;
4266 preimages_constr.datalen = (*env)->GetArrayLength(env, preimages);
4267 if (preimages_constr.datalen > 0)
4268 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4270 preimages_constr.data = NULL;
4271 for (size_t i = 0; i < preimages_constr.datalen; i++) {
4272 int8_tArray preimages_conv_8 = (*env)->GetObjectArrayElement(env, preimages, i);
4273 LDKThirtyTwoBytes preimages_conv_8_ref;
4274 CHECK((*env)->GetArrayLength(env, preimages_conv_8) == 32);
4275 (*env)->GetByteArrayRegion(env, preimages_conv_8, 0, 32, preimages_conv_8_ref.data);
4276 preimages_constr.data[i] = preimages_conv_8_ref;
4278 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4279 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4280 return (int64_t)ret_conv;
4283 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) {
4284 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4285 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4286 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4287 unsigned char secret_arr[32];
4288 CHECK((*env)->GetArrayLength(env, secret) == 32);
4289 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
4290 unsigned char (*secret_ref)[32] = &secret_arr;
4291 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4292 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4293 return (int64_t)ret_conv;
4296 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) {
4297 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4298 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4299 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4300 LDKHolderCommitmentTransaction commitment_tx_conv;
4301 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
4302 commitment_tx_conv.is_owned = false;
4303 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4304 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4305 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4306 return (int64_t)ret_conv;
4309 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) {
4310 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4311 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4312 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4313 LDKTransaction justice_tx_ref;
4314 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
4315 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4316 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
4317 justice_tx_ref.data_is_owned = true;
4318 unsigned char per_commitment_key_arr[32];
4319 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
4320 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
4321 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4322 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4323 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4324 return (int64_t)ret_conv;
4327 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) {
4328 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4329 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4330 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4331 LDKTransaction justice_tx_ref;
4332 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
4333 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4334 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
4335 justice_tx_ref.data_is_owned = true;
4336 unsigned char per_commitment_key_arr[32];
4337 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
4338 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
4339 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4340 LDKHTLCOutputInCommitment htlc_conv;
4341 htlc_conv.inner = (void*)(htlc & (~1));
4342 htlc_conv.is_owned = false;
4343 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4344 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4345 *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);
4346 return (int64_t)ret_conv;
4349 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) {
4350 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4351 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4352 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4353 LDKTransaction htlc_tx_ref;
4354 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
4355 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4356 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
4357 htlc_tx_ref.data_is_owned = true;
4358 LDKPublicKey per_commitment_point_ref;
4359 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
4360 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
4361 LDKHTLCOutputInCommitment htlc_conv;
4362 htlc_conv.inner = (void*)(htlc & (~1));
4363 htlc_conv.is_owned = false;
4364 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4365 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4366 *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);
4367 return (int64_t)ret_conv;
4370 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) {
4371 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4372 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4373 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4374 LDKClosingTransaction closing_tx_conv;
4375 closing_tx_conv.inner = (void*)(closing_tx & (~1));
4376 closing_tx_conv.is_owned = false;
4377 CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4378 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4379 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4380 return (int64_t)ret_conv;
4383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
4384 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4385 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4386 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4387 LDKUnsignedChannelAnnouncement msg_conv;
4388 msg_conv.inner = (void*)(msg & (~1));
4389 msg_conv.is_owned = false;
4390 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4391 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4392 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4393 return (int64_t)ret_conv;
4396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
4397 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4398 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4399 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4400 LDKChannelTransactionParameters channel_parameters_conv;
4401 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
4402 channel_parameters_conv.is_owned = false;
4403 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4404 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4407 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4408 if (this_arg->set_pubkeys != NULL)
4409 this_arg->set_pubkeys(this_arg);
4410 return this_arg->pubkeys;
4412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
4413 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4414 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4415 LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4416 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4417 int64_t ret_ref = 0;
4418 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4419 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4420 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4421 ret_ref = (uintptr_t)ret_var.inner;
4422 if (ret_var.is_owned) {
4428 typedef struct LDKSign_JCalls {
4429 atomic_size_t refcnt;
4432 LDKBaseSign_JCalls* BaseSign;
4433 jmethodID write_meth;
4435 static void LDKSign_JCalls_free(void* this_arg) {
4436 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4437 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4439 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4440 if (get_jenv_res == JNI_EDETACHED) {
4441 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4443 DO_ASSERT(get_jenv_res == JNI_OK);
4445 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4446 if (get_jenv_res == JNI_EDETACHED) {
4447 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4452 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4453 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4455 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4456 if (get_jenv_res == JNI_EDETACHED) {
4457 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4459 DO_ASSERT(get_jenv_res == JNI_OK);
4461 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4463 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4464 if (UNLIKELY((*env)->ExceptionCheck(env))) {
4465 (*env)->ExceptionDescribe(env);
4466 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
4468 LDKCVec_u8Z ret_ref;
4469 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4470 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4471 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4472 if (get_jenv_res == JNI_EDETACHED) {
4473 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4477 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4478 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4479 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4480 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4482 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
4483 jclass c = (*env)->GetObjectClass(env, o);
4485 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4486 atomic_init(&calls->refcnt, 1);
4487 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4488 calls->o = (*env)->NewWeakGlobalRef(env, o);
4489 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4490 CHECK(calls->write_meth != NULL);
4492 LDKChannelPublicKeys pubkeys_conv;
4493 pubkeys_conv.inner = (void*)(pubkeys & (~1));
4494 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
4495 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4498 .this_arg = (void*) calls,
4499 .write = write_LDKSign_jcall,
4500 .cloned = LDKSign_JCalls_cloned,
4501 .free = LDKSign_JCalls_free,
4502 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
4504 calls->BaseSign = ret.BaseSign.this_arg;
4507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
4508 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4509 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
4510 return (uint64_t)res_ptr;
4512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
4513 LDKSign *inp = (LDKSign *)(arg & ~1);
4514 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
4515 DO_ASSERT((res_ptr & 1) == 0);
4516 return (int64_t)(res_ptr | 1);
4518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4519 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
4520 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
4521 LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4522 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4523 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4524 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4525 CVec_u8Z_free(ret_var);
4529 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4530 CHECK(owner->result_ok);
4531 return Sign_clone(&*owner->contents.result);
4533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4534 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4535 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4536 *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4537 return (int64_t)ret_ret;
4540 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4541 CHECK(!owner->result_ok);
4542 return DecodeError_clone(&*owner->contents.err);
4544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4545 LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)(owner & ~1);
4546 LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4547 int64_t ret_ref = 0;
4548 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4549 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4551 ret_ref = (uintptr_t)ret_var.inner;
4552 if (ret_var.is_owned) {
4558 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4559 CHECK(owner->result_ok);
4560 return *owner->contents.result;
4562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4563 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4564 int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
4565 (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
4569 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4570 CHECK(!owner->result_ok);
4571 return *owner->contents.err;
4573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4574 LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)(owner & ~1);
4575 CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4578 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4579 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4580 for (size_t i = 0; i < ret.datalen; i++) {
4581 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4585 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4586 CHECK(owner->result_ok);
4587 return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4589 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4590 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4591 LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4592 jobjectArray ret_arr = NULL;
4593 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
4595 for (size_t i = 0; i < ret_var.datalen; i++) {
4596 LDKCVec_u8Z ret_conv_8_var = ret_var.data[i];
4597 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
4598 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
4599 CVec_u8Z_free(ret_conv_8_var);
4600 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
4607 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4608 CHECK(!owner->result_ok);
4609 return *owner->contents.err;
4611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4612 LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(owner & ~1);
4613 CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4616 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4617 CHECK(owner->result_ok);
4618 return InMemorySigner_clone(&*owner->contents.result);
4620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4621 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4622 LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4623 int64_t ret_ref = 0;
4624 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4625 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4626 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4627 ret_ref = (uintptr_t)ret_var.inner;
4628 if (ret_var.is_owned) {
4634 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4635 CHECK(!owner->result_ok);
4636 return DecodeError_clone(&*owner->contents.err);
4638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4639 LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(owner & ~1);
4640 LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4641 int64_t ret_ref = 0;
4642 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4643 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4644 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4645 ret_ref = (uintptr_t)ret_var.inner;
4646 if (ret_var.is_owned) {
4652 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4653 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4654 for (size_t i = 0; i < ret.datalen; i++) {
4655 ret.data[i] = TxOut_clone(&orig->data[i]);
4659 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4660 CHECK(owner->result_ok);
4661 return *owner->contents.result;
4663 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4664 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4665 LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4666 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4667 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4671 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4672 CHECK(!owner->result_ok);
4673 return *owner->contents.err;
4675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4676 LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)(owner & ~1);
4677 CResult_TransactionNoneZ_get_err(owner_conv);
4680 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
4681 return ThirtyTwoBytes_clone(&owner->a);
4683 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4684 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
4685 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4686 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data);
4690 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
4691 return ChannelMonitor_clone(&owner->b);
4693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4694 LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(owner & ~1);
4695 LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
4696 int64_t ret_ref = 0;
4697 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4698 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4700 ret_ref = (uintptr_t)ret_var.inner;
4701 if (ret_var.is_owned) {
4707 static inline LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *orig) {
4708 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
4709 for (size_t i = 0; i < ret.datalen; i++) {
4710 ret.data[i] = C2Tuple_BlockHashChannelMonitorZ_clone(&orig->data[i]);
4714 static inline struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
4715 CHECK(owner->result_ok);
4716 return CVec_C2Tuple_BlockHashChannelMonitorZZ_clone(&*owner->contents.result);
4718 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4719 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
4720 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(owner_conv);
4721 int64_tArray ret_arr = NULL;
4722 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4723 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4724 for (size_t j = 0; j < ret_var.datalen; j++) {
4725 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv_35_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
4726 *ret_conv_35_conv = ret_var.data[j];
4727 ret_arr_ptr[j] = ((int64_t)ret_conv_35_conv);
4729 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4734 static inline enum LDKIOError CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR owner){
4735 CHECK(!owner->result_ok);
4736 return *owner->contents.err;
4738 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4739 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(owner & ~1);
4740 jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(owner_conv));
4744 static jclass LDKCOption_u16Z_Some_class = NULL;
4745 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
4746 static jclass LDKCOption_u16Z_None_class = NULL;
4747 static jmethodID LDKCOption_u16Z_None_meth = NULL;
4748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
4749 LDKCOption_u16Z_Some_class =
4750 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
4751 CHECK(LDKCOption_u16Z_Some_class != NULL);
4752 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
4753 CHECK(LDKCOption_u16Z_Some_meth != NULL);
4754 LDKCOption_u16Z_None_class =
4755 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
4756 CHECK(LDKCOption_u16Z_None_class != NULL);
4757 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
4758 CHECK(LDKCOption_u16Z_None_meth != NULL);
4760 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4761 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
4763 case LDKCOption_u16Z_Some: {
4764 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
4766 case LDKCOption_u16Z_None: {
4767 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
4772 static jclass LDKAPIError_APIMisuseError_class = NULL;
4773 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
4774 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
4775 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
4776 static jclass LDKAPIError_RouteError_class = NULL;
4777 static jmethodID LDKAPIError_RouteError_meth = NULL;
4778 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
4779 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
4780 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
4781 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
4782 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
4783 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
4784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
4785 LDKAPIError_APIMisuseError_class =
4786 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
4787 CHECK(LDKAPIError_APIMisuseError_class != NULL);
4788 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
4789 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
4790 LDKAPIError_FeeRateTooHigh_class =
4791 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
4792 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
4793 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
4794 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
4795 LDKAPIError_RouteError_class =
4796 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError"));
4797 CHECK(LDKAPIError_RouteError_class != NULL);
4798 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
4799 CHECK(LDKAPIError_RouteError_meth != NULL);
4800 LDKAPIError_ChannelUnavailable_class =
4801 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
4802 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
4803 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
4804 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
4805 LDKAPIError_MonitorUpdateFailed_class =
4806 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed"));
4807 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
4808 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
4809 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
4810 LDKAPIError_IncompatibleShutdownScript_class =
4811 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
4812 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
4813 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
4814 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
4816 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4817 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
4819 case LDKAPIError_APIMisuseError: {
4820 LDKStr err_str = obj->api_misuse_error.err;
4821 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4822 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
4824 case LDKAPIError_FeeRateTooHigh: {
4825 LDKStr err_str = obj->fee_rate_too_high.err;
4826 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4827 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
4829 case LDKAPIError_RouteError: {
4830 LDKStr err_str = obj->route_error.err;
4831 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4832 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
4834 case LDKAPIError_ChannelUnavailable: {
4835 LDKStr err_str = obj->channel_unavailable.err;
4836 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
4837 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
4839 case LDKAPIError_MonitorUpdateFailed: {
4840 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
4842 case LDKAPIError_IncompatibleShutdownScript: {
4843 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4844 int64_t script_ref = 0;
4845 CHECK((((uintptr_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4846 CHECK((((uintptr_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4847 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4848 script_ref = (uintptr_t)script_var.inner & ~1;
4849 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
4854 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4855 CHECK(owner->result_ok);
4856 return *owner->contents.result;
4858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4859 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4860 CResult_NoneAPIErrorZ_get_ok(owner_conv);
4863 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4864 CHECK(!owner->result_ok);
4865 return APIError_clone(&*owner->contents.err);
4867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4868 LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)(owner & ~1);
4869 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4870 *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4871 int64_t ret_ref = (uintptr_t)ret_copy;
4875 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4876 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4877 for (size_t i = 0; i < ret.datalen; i++) {
4878 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4882 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4883 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4884 for (size_t i = 0; i < ret.datalen; i++) {
4885 ret.data[i] = APIError_clone(&orig->data[i]);
4889 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4890 CHECK(owner->result_ok);
4891 return ThirtyTwoBytes_clone(&*owner->contents.result);
4893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4894 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4895 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4896 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult__u832APIErrorZ_get_ok(owner_conv).data);
4900 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4901 CHECK(!owner->result_ok);
4902 return APIError_clone(&*owner->contents.err);
4904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4905 LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)(owner & ~1);
4906 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4907 *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4908 int64_t ret_ref = (uintptr_t)ret_copy;
4912 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
4913 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
4914 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
4915 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
4916 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
4917 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
4918 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
4919 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
4920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
4921 LDKPaymentSendFailure_ParameterError_class =
4922 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
4923 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
4924 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
4925 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
4926 LDKPaymentSendFailure_PathParameterError_class =
4927 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
4928 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
4929 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
4930 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
4931 LDKPaymentSendFailure_AllFailedRetrySafe_class =
4932 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe"));
4933 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
4934 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
4935 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
4936 LDKPaymentSendFailure_PartialFailure_class =
4937 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
4938 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
4939 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
4940 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
4942 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4943 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
4945 case LDKPaymentSendFailure_ParameterError: {
4946 int64_t parameter_error_ref = ((uintptr_t)&obj->parameter_error) | 1;
4947 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
4949 case LDKPaymentSendFailure_PathParameterError: {
4950 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4951 int64_tArray path_parameter_error_arr = NULL;
4952 path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
4953 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
4954 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4955 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4956 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4957 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4958 path_parameter_error_arr_ptr[w] = (int64_t)path_parameter_error_conv_22_conv;
4960 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
4961 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
4963 case LDKPaymentSendFailure_AllFailedRetrySafe: {
4964 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4965 int64_tArray all_failed_retry_safe_arr = NULL;
4966 all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
4967 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
4968 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4969 int64_t all_failed_retry_safe_conv_10_ref = ((uintptr_t)&all_failed_retry_safe_var.data[k]) | 1;
4970 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4972 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
4973 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
4975 case LDKPaymentSendFailure_PartialFailure: {
4976 LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4977 int64_tArray results_arr = NULL;
4978 results_arr = (*env)->NewLongArray(env, results_var.datalen);
4979 int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
4980 for (size_t w = 0; w < results_var.datalen; w++) {
4981 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4982 *results_conv_22_conv = results_var.data[w];
4983 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4984 results_arr_ptr[w] = (int64_t)results_conv_22_conv;
4986 (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
4987 LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4988 int64_t failed_paths_retry_ref = 0;
4989 if ((uintptr_t)failed_paths_retry_var.inner > 4096) {
4990 CHECK((((uintptr_t)failed_paths_retry_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4991 CHECK((((uintptr_t)&failed_paths_retry_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4992 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4993 failed_paths_retry_ref = (uintptr_t)failed_paths_retry_var.inner & ~1;
4995 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
4996 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
4997 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
5002 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5003 CHECK(owner->result_ok);
5004 return ThirtyTwoBytes_clone(&*owner->contents.result);
5006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5007 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5008 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5009 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data);
5013 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
5014 CHECK(!owner->result_ok);
5015 return PaymentSendFailure_clone(&*owner->contents.err);
5017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5018 LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(owner & ~1);
5019 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5020 *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
5021 int64_t ret_ref = (uintptr_t)ret_copy;
5025 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5026 CHECK(owner->result_ok);
5027 return *owner->contents.result;
5029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5030 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5031 CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
5034 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
5035 CHECK(!owner->result_ok);
5036 return PaymentSendFailure_clone(&*owner->contents.err);
5038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5039 LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)(owner & ~1);
5040 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5041 *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
5042 int64_t ret_ref = (uintptr_t)ret_copy;
5046 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5047 return ThirtyTwoBytes_clone(&owner->a);
5049 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5050 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5051 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5052 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data);
5056 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
5057 return ThirtyTwoBytes_clone(&owner->b);
5059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5060 LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(owner & ~1);
5061 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5062 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data);
5066 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5067 CHECK(owner->result_ok);
5068 return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
5070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5071 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5072 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
5073 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
5074 return ((int64_t)ret_conv);
5077 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
5078 CHECK(!owner->result_ok);
5079 return PaymentSendFailure_clone(&*owner->contents.err);
5081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5082 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(owner & ~1);
5083 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
5084 *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
5085 int64_t ret_ref = (uintptr_t)ret_copy;
5089 static jclass LDKNetAddress_IPv4_class = NULL;
5090 static jmethodID LDKNetAddress_IPv4_meth = NULL;
5091 static jclass LDKNetAddress_IPv6_class = NULL;
5092 static jmethodID LDKNetAddress_IPv6_meth = NULL;
5093 static jclass LDKNetAddress_OnionV2_class = NULL;
5094 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
5095 static jclass LDKNetAddress_OnionV3_class = NULL;
5096 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
5097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
5098 LDKNetAddress_IPv4_class =
5099 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4"));
5100 CHECK(LDKNetAddress_IPv4_class != NULL);
5101 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
5102 CHECK(LDKNetAddress_IPv4_meth != NULL);
5103 LDKNetAddress_IPv6_class =
5104 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6"));
5105 CHECK(LDKNetAddress_IPv6_class != NULL);
5106 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
5107 CHECK(LDKNetAddress_IPv6_meth != NULL);
5108 LDKNetAddress_OnionV2_class =
5109 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2"));
5110 CHECK(LDKNetAddress_OnionV2_class != NULL);
5111 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([B)V");
5112 CHECK(LDKNetAddress_OnionV2_meth != NULL);
5113 LDKNetAddress_OnionV3_class =
5114 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3"));
5115 CHECK(LDKNetAddress_OnionV3_class != NULL);
5116 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
5117 CHECK(LDKNetAddress_OnionV3_meth != NULL);
5119 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5120 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
5122 case LDKNetAddress_IPv4: {
5123 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
5124 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
5125 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
5127 case LDKNetAddress_IPv6: {
5128 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
5129 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
5130 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
5132 case LDKNetAddress_OnionV2: {
5133 int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
5134 (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
5135 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr);
5137 case LDKNetAddress_OnionV3: {
5138 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
5139 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
5140 return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, obj->onion_v3.checksum, obj->onion_v3.version, obj->onion_v3.port);
5145 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
5146 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
5147 for (size_t i = 0; i < ret.datalen; i++) {
5148 ret.data[i] = NetAddress_clone(&orig->data[i]);
5152 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5153 return ThirtyTwoBytes_clone(&owner->a);
5155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5156 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5157 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5158 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data);
5162 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
5163 return ThirtyTwoBytes_clone(&owner->b);
5165 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5166 LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(owner & ~1);
5167 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5168 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data);
5172 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5173 CHECK(owner->result_ok);
5174 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5177 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5178 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5179 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
5180 return ((int64_t)ret_conv);
5183 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
5184 CHECK(!owner->result_ok);
5185 return *owner->contents.err;
5187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5188 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(owner & ~1);
5189 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
5192 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5193 CHECK(owner->result_ok);
5194 return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
5196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5197 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5198 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
5199 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
5200 return ((int64_t)ret_conv);
5203 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
5204 CHECK(!owner->result_ok);
5205 return APIError_clone(&*owner->contents.err);
5207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5208 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(owner & ~1);
5209 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5210 *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
5211 int64_t ret_ref = (uintptr_t)ret_copy;
5215 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5216 CHECK(owner->result_ok);
5217 return ThirtyTwoBytes_clone(&*owner->contents.result);
5219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5220 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5221 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5222 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data);
5226 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
5227 CHECK(!owner->result_ok);
5228 return *owner->contents.err;
5230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5231 LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)(owner & ~1);
5232 CResult_PaymentSecretNoneZ_get_err(owner_conv);
5235 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5236 CHECK(owner->result_ok);
5237 return ThirtyTwoBytes_clone(&*owner->contents.result);
5239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5240 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5241 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5242 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data);
5246 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
5247 CHECK(!owner->result_ok);
5248 return APIError_clone(&*owner->contents.err);
5250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5251 LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(owner & ~1);
5252 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5253 *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
5254 int64_t ret_ref = (uintptr_t)ret_copy;
5258 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
5259 CHECK(owner->result_ok);
5260 return ThirtyTwoBytes_clone(&*owner->contents.result);
5262 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5263 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5264 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5265 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data);
5269 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *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_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5274 LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(owner & ~1);
5275 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5276 *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
5277 int64_t ret_ref = (uintptr_t)ret_copy;
5281 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5282 CHECK(owner->result_ok);
5283 return CounterpartyForwardingInfo_clone(&*owner->contents.result);
5285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5286 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
5287 LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5288 int64_t ret_ref = 0;
5289 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5290 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5291 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5292 ret_ref = (uintptr_t)ret_var.inner;
5293 if (ret_var.is_owned) {
5299 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5300 CHECK(!owner->result_ok);
5301 return DecodeError_clone(&*owner->contents.err);
5303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5304 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(owner & ~1);
5305 LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5306 int64_t ret_ref = 0;
5307 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5308 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5309 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5310 ret_ref = (uintptr_t)ret_var.inner;
5311 if (ret_var.is_owned) {
5317 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5318 CHECK(owner->result_ok);
5319 return ChannelCounterparty_clone(&*owner->contents.result);
5321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5322 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
5323 LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5324 int64_t ret_ref = 0;
5325 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5326 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5327 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5328 ret_ref = (uintptr_t)ret_var.inner;
5329 if (ret_var.is_owned) {
5335 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5336 CHECK(!owner->result_ok);
5337 return DecodeError_clone(&*owner->contents.err);
5339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5340 LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(owner & ~1);
5341 LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5342 int64_t ret_ref = 0;
5343 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5344 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5345 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5346 ret_ref = (uintptr_t)ret_var.inner;
5347 if (ret_var.is_owned) {
5353 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5354 CHECK(owner->result_ok);
5355 return ChannelDetails_clone(&*owner->contents.result);
5357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5358 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
5359 LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5360 int64_t ret_ref = 0;
5361 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5362 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5363 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5364 ret_ref = (uintptr_t)ret_var.inner;
5365 if (ret_var.is_owned) {
5371 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5372 CHECK(!owner->result_ok);
5373 return DecodeError_clone(&*owner->contents.err);
5375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5376 LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(owner & ~1);
5377 LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5378 int64_t ret_ref = 0;
5379 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5380 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5381 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5382 ret_ref = (uintptr_t)ret_var.inner;
5383 if (ret_var.is_owned) {
5389 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5390 CHECK(owner->result_ok);
5391 return PhantomRouteHints_clone(&*owner->contents.result);
5393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5394 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
5395 LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5396 int64_t ret_ref = 0;
5397 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5398 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5399 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5400 ret_ref = (uintptr_t)ret_var.inner;
5401 if (ret_var.is_owned) {
5407 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5408 CHECK(!owner->result_ok);
5409 return DecodeError_clone(&*owner->contents.err);
5411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5412 LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(owner & ~1);
5413 LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5414 int64_t ret_ref = 0;
5415 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5416 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5417 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5418 ret_ref = (uintptr_t)ret_var.inner;
5419 if (ret_var.is_owned) {
5425 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5426 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5427 for (size_t i = 0; i < ret.datalen; i++) {
5428 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5432 typedef struct LDKWatch_JCalls {
5433 atomic_size_t refcnt;
5436 jmethodID watch_channel_meth;
5437 jmethodID update_channel_meth;
5438 jmethodID release_pending_monitor_events_meth;
5440 static void LDKWatch_JCalls_free(void* this_arg) {
5441 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5442 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5444 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5445 if (get_jenv_res == JNI_EDETACHED) {
5446 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5448 DO_ASSERT(get_jenv_res == JNI_OK);
5450 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5451 if (get_jenv_res == JNI_EDETACHED) {
5452 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5457 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5458 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5460 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5461 if (get_jenv_res == JNI_EDETACHED) {
5462 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5464 DO_ASSERT(get_jenv_res == JNI_OK);
5466 LDKOutPoint funding_txo_var = funding_txo;
5467 int64_t funding_txo_ref = 0;
5468 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5469 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5470 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5471 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5472 if (funding_txo_var.is_owned) {
5473 funding_txo_ref |= 1;
5475 LDKChannelMonitor monitor_var = monitor;
5476 int64_t monitor_ref = 0;
5477 CHECK((((uintptr_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5478 CHECK((((uintptr_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5479 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5480 monitor_ref = (uintptr_t)monitor_var.inner;
5481 if (monitor_var.is_owned) {
5484 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5486 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
5487 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5488 (*env)->ExceptionDescribe(env);
5489 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
5491 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5492 CHECK_ACCESS(ret_ptr);
5493 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5495 if (get_jenv_res == JNI_EDETACHED) {
5496 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5500 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5501 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5503 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5504 if (get_jenv_res == JNI_EDETACHED) {
5505 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5507 DO_ASSERT(get_jenv_res == JNI_OK);
5509 LDKOutPoint funding_txo_var = funding_txo;
5510 int64_t funding_txo_ref = 0;
5511 CHECK((((uintptr_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5512 CHECK((((uintptr_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5513 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5514 funding_txo_ref = (uintptr_t)funding_txo_var.inner;
5515 if (funding_txo_var.is_owned) {
5516 funding_txo_ref |= 1;
5518 LDKChannelMonitorUpdate update_var = update;
5519 int64_t update_ref = 0;
5520 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5521 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5522 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5523 update_ref = (uintptr_t)update_var.inner;
5524 if (update_var.is_owned) {
5527 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5529 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
5530 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5531 (*env)->ExceptionDescribe(env);
5532 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
5534 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5535 CHECK_ACCESS(ret_ptr);
5536 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5538 if (get_jenv_res == JNI_EDETACHED) {
5539 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5543 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5544 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5546 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5547 if (get_jenv_res == JNI_EDETACHED) {
5548 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5550 DO_ASSERT(get_jenv_res == JNI_OK);
5552 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5554 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
5555 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5556 (*env)->ExceptionDescribe(env);
5557 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
5559 LDKCVec_MonitorEventZ ret_constr;
5560 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5561 if (ret_constr.datalen > 0)
5562 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5564 ret_constr.data = NULL;
5565 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5566 for (size_t o = 0; o < ret_constr.datalen; o++) {
5567 int64_t ret_conv_14 = ret_vals[o];
5568 void* ret_conv_14_ptr = (void*)(((uintptr_t)ret_conv_14) & ~1);
5569 CHECK_ACCESS(ret_conv_14_ptr);
5570 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(ret_conv_14_ptr);
5571 FREE((void*)ret_conv_14);
5572 ret_constr.data[o] = ret_conv_14_conv;
5574 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5575 if (get_jenv_res == JNI_EDETACHED) {
5576 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5580 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5581 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5582 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5584 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
5585 jclass c = (*env)->GetObjectClass(env, o);
5587 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5588 atomic_init(&calls->refcnt, 1);
5589 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5590 calls->o = (*env)->NewWeakGlobalRef(env, o);
5591 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
5592 CHECK(calls->watch_channel_meth != NULL);
5593 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
5594 CHECK(calls->update_channel_meth != NULL);
5595 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
5596 CHECK(calls->release_pending_monitor_events_meth != NULL);
5599 .this_arg = (void*) calls,
5600 .watch_channel = watch_channel_LDKWatch_jcall,
5601 .update_channel = update_channel_LDKWatch_jcall,
5602 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5603 .free = LDKWatch_JCalls_free,
5607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
5608 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5609 *res_ptr = LDKWatch_init(env, clz, o);
5610 return (uint64_t)res_ptr;
5612 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) {
5613 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5614 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5615 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5616 LDKOutPoint funding_txo_conv;
5617 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5618 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5619 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5620 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5621 LDKChannelMonitor monitor_conv;
5622 monitor_conv.inner = (void*)(monitor & (~1));
5623 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
5624 CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5625 monitor_conv = ChannelMonitor_clone(&monitor_conv);
5626 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5627 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5628 return (int64_t)ret_conv;
5631 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) {
5632 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5633 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5634 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5635 LDKOutPoint funding_txo_conv;
5636 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5637 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5638 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5639 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5640 LDKChannelMonitorUpdate update_conv;
5641 update_conv.inner = (void*)(update & (~1));
5642 update_conv.is_owned = (update & 1) || (update == 0);
5643 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5644 update_conv = ChannelMonitorUpdate_clone(&update_conv);
5645 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5646 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5647 return (int64_t)ret_conv;
5650 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
5651 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5652 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5653 LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5654 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5655 int64_tArray ret_arr = NULL;
5656 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5657 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5658 for (size_t o = 0; o < ret_var.datalen; o++) {
5659 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5660 *ret_conv_14_copy = ret_var.data[o];
5661 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
5662 ret_arr_ptr[o] = ret_conv_14_ref;
5664 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5669 typedef struct LDKBroadcasterInterface_JCalls {
5670 atomic_size_t refcnt;
5673 jmethodID broadcast_transaction_meth;
5674 } LDKBroadcasterInterface_JCalls;
5675 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5676 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5677 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5679 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5680 if (get_jenv_res == JNI_EDETACHED) {
5681 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5683 DO_ASSERT(get_jenv_res == JNI_OK);
5685 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5686 if (get_jenv_res == JNI_EDETACHED) {
5687 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5692 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5693 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5695 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5696 if (get_jenv_res == JNI_EDETACHED) {
5697 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5699 DO_ASSERT(get_jenv_res == JNI_OK);
5701 LDKTransaction tx_var = tx;
5702 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
5703 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
5704 Transaction_free(tx_var);
5705 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5707 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
5708 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5709 (*env)->ExceptionDescribe(env);
5710 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
5712 if (get_jenv_res == JNI_EDETACHED) {
5713 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5716 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5717 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5718 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5720 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
5721 jclass c = (*env)->GetObjectClass(env, o);
5723 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5724 atomic_init(&calls->refcnt, 1);
5725 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5726 calls->o = (*env)->NewWeakGlobalRef(env, o);
5727 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
5728 CHECK(calls->broadcast_transaction_meth != NULL);
5730 LDKBroadcasterInterface ret = {
5731 .this_arg = (void*) calls,
5732 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5733 .free = LDKBroadcasterInterface_JCalls_free,
5737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
5738 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5739 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
5740 return (uint64_t)res_ptr;
5742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
5743 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
5744 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
5745 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5746 LDKTransaction tx_ref;
5747 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
5748 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5749 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
5750 tx_ref.data_is_owned = true;
5751 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5754 typedef struct LDKKeysInterface_JCalls {
5755 atomic_size_t refcnt;
5758 jmethodID get_node_secret_meth;
5759 jmethodID get_destination_script_meth;
5760 jmethodID get_shutdown_scriptpubkey_meth;
5761 jmethodID get_channel_signer_meth;
5762 jmethodID get_secure_random_bytes_meth;
5763 jmethodID read_chan_signer_meth;
5764 jmethodID sign_invoice_meth;
5765 jmethodID get_inbound_payment_key_material_meth;
5766 } LDKKeysInterface_JCalls;
5767 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5768 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5769 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5771 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5772 if (get_jenv_res == JNI_EDETACHED) {
5773 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5775 DO_ASSERT(get_jenv_res == JNI_OK);
5777 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5778 if (get_jenv_res == JNI_EDETACHED) {
5779 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5784 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5785 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5787 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5788 if (get_jenv_res == JNI_EDETACHED) {
5789 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5791 DO_ASSERT(get_jenv_res == JNI_OK);
5793 jclass recipient_conv = LDKRecipient_to_java(env, recipient);
5794 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5796 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth, recipient_conv);
5797 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5798 (*env)->ExceptionDescribe(env);
5799 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
5801 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5802 CHECK_ACCESS(ret_ptr);
5803 LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5805 if (get_jenv_res == JNI_EDETACHED) {
5806 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5810 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5811 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5813 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5814 if (get_jenv_res == JNI_EDETACHED) {
5815 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5817 DO_ASSERT(get_jenv_res == JNI_OK);
5819 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5821 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
5822 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5823 (*env)->ExceptionDescribe(env);
5824 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
5826 LDKCVec_u8Z ret_ref;
5827 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
5828 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5829 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
5830 if (get_jenv_res == JNI_EDETACHED) {
5831 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5835 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5836 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5838 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5839 if (get_jenv_res == JNI_EDETACHED) {
5840 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5842 DO_ASSERT(get_jenv_res == JNI_OK);
5844 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5846 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
5847 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5848 (*env)->ExceptionDescribe(env);
5849 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
5851 LDKShutdownScript ret_conv;
5852 ret_conv.inner = (void*)(ret & (~1));
5853 ret_conv.is_owned = (ret & 1) || (ret == 0);
5854 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5855 if (get_jenv_res == JNI_EDETACHED) {
5856 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5860 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5861 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5863 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5864 if (get_jenv_res == JNI_EDETACHED) {
5865 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5867 DO_ASSERT(get_jenv_res == JNI_OK);
5869 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5871 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
5872 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5873 (*env)->ExceptionDescribe(env);
5874 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
5876 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5877 CHECK_ACCESS(ret_ptr);
5878 LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5880 if (get_jenv_res == JNI_EDETACHED) {
5881 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5885 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5886 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5888 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5889 if (get_jenv_res == JNI_EDETACHED) {
5890 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5892 DO_ASSERT(get_jenv_res == JNI_OK);
5894 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5896 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
5897 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5898 (*env)->ExceptionDescribe(env);
5899 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
5901 LDKThirtyTwoBytes ret_ref;
5902 CHECK((*env)->GetArrayLength(env, ret) == 32);
5903 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5904 if (get_jenv_res == JNI_EDETACHED) {
5905 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5909 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5910 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5912 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5913 if (get_jenv_res == JNI_EDETACHED) {
5914 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5916 DO_ASSERT(get_jenv_res == JNI_OK);
5918 LDKu8slice reader_var = reader;
5919 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
5920 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
5921 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5923 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
5924 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5925 (*env)->ExceptionDescribe(env);
5926 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
5928 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5929 CHECK_ACCESS(ret_ptr);
5930 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5932 if (get_jenv_res == JNI_EDETACHED) {
5933 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5937 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5938 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5940 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5941 if (get_jenv_res == JNI_EDETACHED) {
5942 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5944 DO_ASSERT(get_jenv_res == JNI_OK);
5946 LDKu8slice hrp_bytes_var = hrp_bytes;
5947 int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
5948 (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
5949 LDKCVec_u5Z invoice_data_var = invoice_data;
5950 jobjectArray invoice_data_arr = NULL;
5951 invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
5952 int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
5953 for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5954 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5955 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5957 (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
5958 FREE(invoice_data_var.data);
5959 jclass receipient_conv = LDKRecipient_to_java(env, receipient);
5960 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5962 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, receipient_conv);
5963 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5964 (*env)->ExceptionDescribe(env);
5965 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
5967 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
5968 CHECK_ACCESS(ret_ptr);
5969 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5971 if (get_jenv_res == JNI_EDETACHED) {
5972 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5976 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5977 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5979 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5980 if (get_jenv_res == JNI_EDETACHED) {
5981 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5983 DO_ASSERT(get_jenv_res == JNI_OK);
5985 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5987 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
5988 if (UNLIKELY((*env)->ExceptionCheck(env))) {
5989 (*env)->ExceptionDescribe(env);
5990 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception.");
5992 LDKThirtyTwoBytes ret_ref;
5993 CHECK((*env)->GetArrayLength(env, ret) == 32);
5994 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
5995 if (get_jenv_res == JNI_EDETACHED) {
5996 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6000 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
6001 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
6002 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6004 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
6005 jclass c = (*env)->GetObjectClass(env, o);
6007 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
6008 atomic_init(&calls->refcnt, 1);
6009 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6010 calls->o = (*env)->NewWeakGlobalRef(env, o);
6011 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "(Lorg/ldk/enums/Recipient;)J");
6012 CHECK(calls->get_node_secret_meth != NULL);
6013 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
6014 CHECK(calls->get_destination_script_meth != NULL);
6015 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
6016 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
6017 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
6018 CHECK(calls->get_channel_signer_meth != NULL);
6019 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
6020 CHECK(calls->get_secure_random_bytes_meth != NULL);
6021 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
6022 CHECK(calls->read_chan_signer_meth != NULL);
6023 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
6024 CHECK(calls->sign_invoice_meth != NULL);
6025 calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
6026 CHECK(calls->get_inbound_payment_key_material_meth != NULL);
6028 LDKKeysInterface ret = {
6029 .this_arg = (void*) calls,
6030 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
6031 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
6032 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
6033 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
6034 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
6035 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
6036 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
6037 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
6038 .free = LDKKeysInterface_JCalls_free,
6042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
6043 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6044 *res_ptr = LDKKeysInterface_init(env, clz, o);
6045 return (uint64_t)res_ptr;
6047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
6048 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6049 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6050 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6051 LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
6052 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
6053 *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
6054 return (int64_t)ret_conv;
6057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
6058 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6059 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6060 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6061 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
6062 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6063 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6064 CVec_u8Z_free(ret_var);
6068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
6069 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6070 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6071 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6072 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
6073 int64_t ret_ref = 0;
6074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6075 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6077 ret_ref = (uintptr_t)ret_var.inner;
6078 if (ret_var.is_owned) {
6084 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) {
6085 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6086 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6087 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6088 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
6089 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
6090 return (int64_t)ret_ret;
6093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
6094 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6095 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6096 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6097 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6098 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
6102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
6103 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6104 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6105 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6106 LDKu8slice reader_ref;
6107 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
6108 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
6109 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
6110 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
6111 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
6112 return (int64_t)ret_conv;
6115 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) {
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 LDKu8slice hrp_bytes_ref;
6120 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
6121 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
6122 LDKCVec_u5Z invoice_data_constr;
6123 invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
6124 if (invoice_data_constr.datalen > 0)
6125 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
6127 invoice_data_constr.data = NULL;
6128 int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
6129 for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6130 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6132 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
6134 (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
6135 LDKRecipient receipient_conv = LDKRecipient_from_java(env, receipient);
6136 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6137 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
6138 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
6139 return (int64_t)ret_conv;
6142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
6143 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6144 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6145 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
6146 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6147 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
6151 typedef struct LDKFeeEstimator_JCalls {
6152 atomic_size_t refcnt;
6155 jmethodID get_est_sat_per_1000_weight_meth;
6156 } LDKFeeEstimator_JCalls;
6157 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
6158 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6159 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6161 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6162 if (get_jenv_res == JNI_EDETACHED) {
6163 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6165 DO_ASSERT(get_jenv_res == JNI_OK);
6167 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6168 if (get_jenv_res == JNI_EDETACHED) {
6169 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6174 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
6175 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
6177 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6178 if (get_jenv_res == JNI_EDETACHED) {
6179 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6181 DO_ASSERT(get_jenv_res == JNI_OK);
6183 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
6184 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6186 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
6187 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6188 (*env)->ExceptionDescribe(env);
6189 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
6191 if (get_jenv_res == JNI_EDETACHED) {
6192 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6196 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
6197 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
6198 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6200 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
6201 jclass c = (*env)->GetObjectClass(env, o);
6203 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
6204 atomic_init(&calls->refcnt, 1);
6205 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6206 calls->o = (*env)->NewWeakGlobalRef(env, o);
6207 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
6208 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
6210 LDKFeeEstimator ret = {
6211 .this_arg = (void*) calls,
6212 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
6213 .free = LDKFeeEstimator_JCalls_free,
6217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
6218 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
6219 *res_ptr = LDKFeeEstimator_init(env, clz, o);
6220 return (uint64_t)res_ptr;
6222 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) {
6223 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6224 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6225 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
6226 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
6227 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
6231 typedef struct LDKLogger_JCalls {
6232 atomic_size_t refcnt;
6237 static void LDKLogger_JCalls_free(void* this_arg) {
6238 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6239 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6241 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6242 if (get_jenv_res == JNI_EDETACHED) {
6243 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6245 DO_ASSERT(get_jenv_res == JNI_OK);
6247 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6248 if (get_jenv_res == JNI_EDETACHED) {
6249 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6254 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
6255 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
6257 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6258 if (get_jenv_res == JNI_EDETACHED) {
6259 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6261 DO_ASSERT(get_jenv_res == JNI_OK);
6263 LDKRecord record_var = *record;
6264 int64_t record_ref = 0;
6265 record_var = Record_clone(&record_var);
6266 CHECK((((uintptr_t)record_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6267 CHECK((((uintptr_t)&record_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6268 CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
6269 record_ref = (uintptr_t)record_var.inner;
6270 if (record_var.is_owned) {
6273 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6275 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
6276 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6277 (*env)->ExceptionDescribe(env);
6278 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
6280 if (get_jenv_res == JNI_EDETACHED) {
6281 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6284 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
6285 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
6286 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6288 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
6289 jclass c = (*env)->GetObjectClass(env, o);
6291 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
6292 atomic_init(&calls->refcnt, 1);
6293 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6294 calls->o = (*env)->NewWeakGlobalRef(env, o);
6295 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
6296 CHECK(calls->log_meth != NULL);
6299 .this_arg = (void*) calls,
6300 .log = log_LDKLogger_jcall,
6301 .free = LDKLogger_JCalls_free,
6305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
6306 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
6307 *res_ptr = LDKLogger_init(env, clz, o);
6308 return (uint64_t)res_ptr;
6310 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6311 return ThirtyTwoBytes_clone(&owner->a);
6313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6314 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6315 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6316 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data);
6320 static inline struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
6323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6324 LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)(owner & ~1);
6325 LDKChannelManager ret_var = *C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
6326 int64_t ret_ref = 0;
6327 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6328 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6330 ret_ref = (uintptr_t)ret_var.inner & ~1;
6334 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6335 CHECK(owner->result_ok);
6336 return &*owner->contents.result;
6338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6339 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6340 int64_t ret_ret = (uintptr_t)CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv) | 1;
6344 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
6345 CHECK(!owner->result_ok);
6346 return DecodeError_clone(&*owner->contents.err);
6348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6349 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(owner & ~1);
6350 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
6351 int64_t ret_ref = 0;
6352 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6353 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6354 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6355 ret_ref = (uintptr_t)ret_var.inner;
6356 if (ret_var.is_owned) {
6362 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6363 CHECK(owner->result_ok);
6364 return ChannelConfig_clone(&*owner->contents.result);
6366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6367 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
6368 LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
6369 int64_t ret_ref = 0;
6370 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6371 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6372 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6373 ret_ref = (uintptr_t)ret_var.inner;
6374 if (ret_var.is_owned) {
6380 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
6381 CHECK(!owner->result_ok);
6382 return DecodeError_clone(&*owner->contents.err);
6384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6385 LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(owner & ~1);
6386 LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
6387 int64_t ret_ref = 0;
6388 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6389 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6391 ret_ref = (uintptr_t)ret_var.inner;
6392 if (ret_var.is_owned) {
6398 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6399 CHECK(owner->result_ok);
6400 return OutPoint_clone(&*owner->contents.result);
6402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6403 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
6404 LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
6405 int64_t ret_ref = 0;
6406 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6407 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6409 ret_ref = (uintptr_t)ret_var.inner;
6410 if (ret_var.is_owned) {
6416 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
6417 CHECK(!owner->result_ok);
6418 return DecodeError_clone(&*owner->contents.err);
6420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6421 LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)(owner & ~1);
6422 LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
6423 int64_t ret_ref = 0;
6424 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6425 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6426 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6427 ret_ref = (uintptr_t)ret_var.inner;
6428 if (ret_var.is_owned) {
6434 typedef struct LDKType_JCalls {
6435 atomic_size_t refcnt;
6438 jmethodID type_id_meth;
6439 jmethodID debug_str_meth;
6440 jmethodID write_meth;
6442 static void LDKType_JCalls_free(void* this_arg) {
6443 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6444 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6446 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6447 if (get_jenv_res == JNI_EDETACHED) {
6448 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6450 DO_ASSERT(get_jenv_res == JNI_OK);
6452 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6453 if (get_jenv_res == JNI_EDETACHED) {
6454 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6459 uint16_t type_id_LDKType_jcall(const void* this_arg) {
6460 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6462 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6463 if (get_jenv_res == JNI_EDETACHED) {
6464 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6466 DO_ASSERT(get_jenv_res == JNI_OK);
6468 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6470 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
6471 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6472 (*env)->ExceptionDescribe(env);
6473 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
6475 if (get_jenv_res == JNI_EDETACHED) {
6476 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6480 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
6481 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6483 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6484 if (get_jenv_res == JNI_EDETACHED) {
6485 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6487 DO_ASSERT(get_jenv_res == JNI_OK);
6489 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6491 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
6492 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6493 (*env)->ExceptionDescribe(env);
6494 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
6496 LDKStr ret_conv = java_to_owned_str(env, ret);
6497 if (get_jenv_res == JNI_EDETACHED) {
6498 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6502 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
6503 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
6505 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6506 if (get_jenv_res == JNI_EDETACHED) {
6507 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6509 DO_ASSERT(get_jenv_res == JNI_OK);
6511 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6513 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
6514 if (UNLIKELY((*env)->ExceptionCheck(env))) {
6515 (*env)->ExceptionDescribe(env);
6516 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
6518 LDKCVec_u8Z ret_ref;
6519 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
6520 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6521 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
6522 if (get_jenv_res == JNI_EDETACHED) {
6523 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6527 static void LDKType_JCalls_cloned(LDKType* new_obj) {
6528 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
6529 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6531 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
6532 jclass c = (*env)->GetObjectClass(env, o);
6534 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
6535 atomic_init(&calls->refcnt, 1);
6536 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6537 calls->o = (*env)->NewWeakGlobalRef(env, o);
6538 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
6539 CHECK(calls->type_id_meth != NULL);
6540 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
6541 CHECK(calls->debug_str_meth != NULL);
6542 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
6543 CHECK(calls->write_meth != NULL);
6546 .this_arg = (void*) calls,
6547 .type_id = type_id_LDKType_jcall,
6548 .debug_str = debug_str_LDKType_jcall,
6549 .write = write_LDKType_jcall,
6550 .cloned = LDKType_JCalls_cloned,
6551 .free = LDKType_JCalls_free,
6555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
6556 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
6557 *res_ptr = LDKType_init(env, clz, o);
6558 return (uint64_t)res_ptr;
6560 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
6561 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6562 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6563 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6564 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
6568 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
6569 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6570 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6571 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6572 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
6573 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
6578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
6579 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
6580 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
6581 LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
6582 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6583 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
6584 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
6585 CVec_u8Z_free(ret_var);
6589 static jclass LDKCOption_TypeZ_Some_class = NULL;
6590 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
6591 static jclass LDKCOption_TypeZ_None_class = NULL;
6592 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
6593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
6594 LDKCOption_TypeZ_Some_class =
6595 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
6596 CHECK(LDKCOption_TypeZ_Some_class != NULL);
6597 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
6598 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
6599 LDKCOption_TypeZ_None_class =
6600 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
6601 CHECK(LDKCOption_TypeZ_None_class != NULL);
6602 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
6603 CHECK(LDKCOption_TypeZ_None_meth != NULL);
6605 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6606 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
6608 case LDKCOption_TypeZ_Some: {
6609 LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
6610 *some_ret = Type_clone(&obj->some);
6611 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (int64_t)some_ret);
6613 case LDKCOption_TypeZ_None: {
6614 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
6619 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6620 CHECK(owner->result_ok);
6621 return COption_TypeZ_clone(&*owner->contents.result);
6623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6624 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6625 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
6626 *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
6627 int64_t ret_ref = (uintptr_t)ret_copy;
6631 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
6632 CHECK(!owner->result_ok);
6633 return DecodeError_clone(&*owner->contents.err);
6635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6636 LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(owner & ~1);
6637 LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
6638 int64_t ret_ref = 0;
6639 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6640 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6641 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6642 ret_ref = (uintptr_t)ret_var.inner;
6643 if (ret_var.is_owned) {
6649 static jclass LDKPaymentError_Invoice_class = NULL;
6650 static jmethodID LDKPaymentError_Invoice_meth = NULL;
6651 static jclass LDKPaymentError_Routing_class = NULL;
6652 static jmethodID LDKPaymentError_Routing_meth = NULL;
6653 static jclass LDKPaymentError_Sending_class = NULL;
6654 static jmethodID LDKPaymentError_Sending_meth = NULL;
6655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) {
6656 LDKPaymentError_Invoice_class =
6657 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice"));
6658 CHECK(LDKPaymentError_Invoice_class != NULL);
6659 LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "<init>", "(Ljava/lang/String;)V");
6660 CHECK(LDKPaymentError_Invoice_meth != NULL);
6661 LDKPaymentError_Routing_class =
6662 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing"));
6663 CHECK(LDKPaymentError_Routing_class != NULL);
6664 LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "<init>", "(J)V");
6665 CHECK(LDKPaymentError_Routing_meth != NULL);
6666 LDKPaymentError_Sending_class =
6667 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending"));
6668 CHECK(LDKPaymentError_Sending_class != NULL);
6669 LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "<init>", "(J)V");
6670 CHECK(LDKPaymentError_Sending_meth != NULL);
6672 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6673 LDKPaymentError *obj = (LDKPaymentError*)(ptr & ~1);
6675 case LDKPaymentError_Invoice: {
6676 LDKStr invoice_str = obj->invoice;
6677 jstring invoice_conv = str_ref_to_java(env, invoice_str.chars, invoice_str.len);
6678 return (*env)->NewObject(env, LDKPaymentError_Invoice_class, LDKPaymentError_Invoice_meth, invoice_conv);
6680 case LDKPaymentError_Routing: {
6681 LDKLightningError routing_var = obj->routing;
6682 int64_t routing_ref = 0;
6683 CHECK((((uintptr_t)routing_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6684 CHECK((((uintptr_t)&routing_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6685 CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
6686 routing_ref = (uintptr_t)routing_var.inner & ~1;
6687 return (*env)->NewObject(env, LDKPaymentError_Routing_class, LDKPaymentError_Routing_meth, routing_ref);
6689 case LDKPaymentError_Sending: {
6690 int64_t sending_ref = ((uintptr_t)&obj->sending) | 1;
6691 return (*env)->NewObject(env, LDKPaymentError_Sending_class, LDKPaymentError_Sending_meth, sending_ref);
6696 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6697 CHECK(owner->result_ok);
6698 return ThirtyTwoBytes_clone(&*owner->contents.result);
6700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6701 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6702 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6703 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data);
6707 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
6708 CHECK(!owner->result_ok);
6709 return PaymentError_clone(&*owner->contents.err);
6711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6712 LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(owner & ~1);
6713 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
6714 *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
6715 int64_t ret_ref = (uintptr_t)ret_copy;
6719 static inline enum LDKSiPrefix CResult_SiPrefixNoneZ_get_ok(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){
6720 CHECK(owner->result_ok);
6721 return SiPrefix_clone(&*owner->contents.result);
6723 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6724 LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1);
6725 jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixNoneZ_get_ok(owner_conv));
6729 static inline void CResult_SiPrefixNoneZ_get_err(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){
6730 CHECK(!owner->result_ok);
6731 return *owner->contents.err;
6733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6734 LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1);
6735 CResult_SiPrefixNoneZ_get_err(owner_conv);
6738 static inline struct LDKInvoice CResult_InvoiceNoneZ_get_ok(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){
6739 CHECK(owner->result_ok);
6740 return Invoice_clone(&*owner->contents.result);
6742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6743 LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1);
6744 LDKInvoice ret_var = CResult_InvoiceNoneZ_get_ok(owner_conv);
6745 int64_t ret_ref = 0;
6746 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6747 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6748 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6749 ret_ref = (uintptr_t)ret_var.inner;
6750 if (ret_var.is_owned) {
6756 static inline void CResult_InvoiceNoneZ_get_err(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){
6757 CHECK(!owner->result_ok);
6758 return *owner->contents.err;
6760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6761 LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1);
6762 CResult_InvoiceNoneZ_get_err(owner_conv);
6765 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceNoneZ_get_ok(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){
6766 CHECK(owner->result_ok);
6767 return SignedRawInvoice_clone(&*owner->contents.result);
6769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6770 LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1);
6771 LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceNoneZ_get_ok(owner_conv);
6772 int64_t ret_ref = 0;
6773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6776 ret_ref = (uintptr_t)ret_var.inner;
6777 if (ret_var.is_owned) {
6783 static inline void CResult_SignedRawInvoiceNoneZ_get_err(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){
6784 CHECK(!owner->result_ok);
6785 return *owner->contents.err;
6787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6788 LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1);
6789 CResult_SignedRawInvoiceNoneZ_get_err(owner_conv);
6792 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6793 return RawInvoice_clone(&owner->a);
6795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6796 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6797 LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
6798 int64_t ret_ref = 0;
6799 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6800 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6802 ret_ref = (uintptr_t)ret_var.inner;
6803 if (ret_var.is_owned) {
6809 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6810 return ThirtyTwoBytes_clone(&owner->b);
6812 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6813 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6814 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
6815 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data);
6819 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6820 return InvoiceSignature_clone(&owner->c);
6822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
6823 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(owner & ~1);
6824 LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
6825 int64_t ret_ref = 0;
6826 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6827 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6828 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6829 ret_ref = (uintptr_t)ret_var.inner;
6830 if (ret_var.is_owned) {
6836 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6837 CHECK(owner->result_ok);
6838 return PayeePubKey_clone(&*owner->contents.result);
6840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6841 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6842 LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
6843 int64_t ret_ref = 0;
6844 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6845 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6847 ret_ref = (uintptr_t)ret_var.inner;
6848 if (ret_var.is_owned) {
6854 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6855 CHECK(!owner->result_ok);
6856 return *owner->contents.err;
6858 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6859 LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)(owner & ~1);
6860 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeyErrorZ_get_err(owner_conv));
6864 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
6865 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
6866 for (size_t i = 0; i < ret.datalen; i++) {
6867 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
6871 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6872 CHECK(owner->result_ok);
6873 return PositiveTimestamp_clone(&*owner->contents.result);
6875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6876 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6877 LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6878 int64_t ret_ref = 0;
6879 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6880 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6881 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6882 ret_ref = (uintptr_t)ret_var.inner;
6883 if (ret_var.is_owned) {
6889 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6890 CHECK(!owner->result_ok);
6891 return CreationError_clone(&*owner->contents.err);
6893 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6894 LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(owner & ~1);
6895 jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6899 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6900 CHECK(owner->result_ok);
6901 return *owner->contents.result;
6903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6904 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6905 CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6908 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6909 CHECK(!owner->result_ok);
6910 return SemanticError_clone(&*owner->contents.err);
6912 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6913 LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)(owner & ~1);
6914 jclass ret_conv = LDKSemanticError_to_java(env, CResult_NoneSemanticErrorZ_get_err(owner_conv));
6918 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6919 CHECK(owner->result_ok);
6920 return Invoice_clone(&*owner->contents.result);
6922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6923 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6924 LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6925 int64_t ret_ref = 0;
6926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6929 ret_ref = (uintptr_t)ret_var.inner;
6930 if (ret_var.is_owned) {
6936 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6937 CHECK(!owner->result_ok);
6938 return SemanticError_clone(&*owner->contents.err);
6940 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6941 LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)(owner & ~1);
6942 jclass ret_conv = LDKSemanticError_to_java(env, CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6946 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6947 CHECK(owner->result_ok);
6948 return Description_clone(&*owner->contents.result);
6950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6951 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6952 LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6953 int64_t ret_ref = 0;
6954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6957 ret_ref = (uintptr_t)ret_var.inner;
6958 if (ret_var.is_owned) {
6964 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6965 CHECK(!owner->result_ok);
6966 return CreationError_clone(&*owner->contents.err);
6968 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6969 LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)(owner & ~1);
6970 jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6974 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6975 CHECK(owner->result_ok);
6976 return PrivateRoute_clone(&*owner->contents.result);
6978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6979 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6980 LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6981 int64_t ret_ref = 0;
6982 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6983 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6984 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6985 ret_ref = (uintptr_t)ret_var.inner;
6986 if (ret_var.is_owned) {
6992 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6993 CHECK(!owner->result_ok);
6994 return CreationError_clone(&*owner->contents.err);
6996 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6997 LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(owner & ~1);
6998 jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
7002 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7003 CHECK(owner->result_ok);
7004 return *owner->contents.result;
7006 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7007 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
7008 LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
7009 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
7013 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7014 CHECK(!owner->result_ok);
7015 return *owner->contents.err;
7017 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7018 LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)(owner & ~1);
7019 jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StringErrorZ_get_err(owner_conv));
7023 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7024 CHECK(owner->result_ok);
7025 return ChannelMonitorUpdate_clone(&*owner->contents.result);
7027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7028 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
7029 LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7030 int64_t ret_ref = 0;
7031 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7032 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7033 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7034 ret_ref = (uintptr_t)ret_var.inner;
7035 if (ret_var.is_owned) {
7041 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7042 CHECK(!owner->result_ok);
7043 return DecodeError_clone(&*owner->contents.err);
7045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7046 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(owner & ~1);
7047 LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7048 int64_t ret_ref = 0;
7049 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7050 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7051 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7052 ret_ref = (uintptr_t)ret_var.inner;
7053 if (ret_var.is_owned) {
7059 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
7060 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
7061 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
7062 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
7063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
7064 LDKCOption_MonitorEventZ_Some_class =
7065 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
7066 CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
7067 LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
7068 CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
7069 LDKCOption_MonitorEventZ_None_class =
7070 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
7071 CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
7072 LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
7073 CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
7075 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7076 LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)(ptr & ~1);
7078 case LDKCOption_MonitorEventZ_Some: {
7079 int64_t some_ref = ((uintptr_t)&obj->some) | 1;
7080 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
7082 case LDKCOption_MonitorEventZ_None: {
7083 return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
7088 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7089 CHECK(owner->result_ok);
7090 return COption_MonitorEventZ_clone(&*owner->contents.result);
7092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7093 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
7094 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7095 *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7096 int64_t ret_ref = (uintptr_t)ret_copy;
7100 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7101 CHECK(!owner->result_ok);
7102 return DecodeError_clone(&*owner->contents.err);
7104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7105 LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(owner & ~1);
7106 LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7107 int64_t ret_ref = 0;
7108 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7109 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7110 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7111 ret_ref = (uintptr_t)ret_var.inner;
7112 if (ret_var.is_owned) {
7118 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7119 CHECK(owner->result_ok);
7120 return HTLCUpdate_clone(&*owner->contents.result);
7122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7123 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
7124 LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7125 int64_t ret_ref = 0;
7126 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7127 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7128 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7129 ret_ref = (uintptr_t)ret_var.inner;
7130 if (ret_var.is_owned) {
7136 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7137 CHECK(!owner->result_ok);
7138 return DecodeError_clone(&*owner->contents.err);
7140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7141 LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(owner & ~1);
7142 LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7143 int64_t ret_ref = 0;
7144 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7145 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7146 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7147 ret_ref = (uintptr_t)ret_var.inner;
7148 if (ret_var.is_owned) {
7154 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7155 return OutPoint_clone(&owner->a);
7157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7158 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
7159 LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
7160 int64_t ret_ref = 0;
7161 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7162 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7164 ret_ref = (uintptr_t)ret_var.inner;
7165 if (ret_var.is_owned) {
7171 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7172 return CVec_u8Z_clone(&owner->b);
7174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7175 LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)(owner & ~1);
7176 LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
7177 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7178 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7179 CVec_u8Z_free(ret_var);
7183 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7186 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7187 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
7188 int32_t ret_val = C2Tuple_u32ScriptZ_get_a(owner_conv);
7192 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7193 return CVec_u8Z_clone(&owner->b);
7195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7196 LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)(owner & ~1);
7197 LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
7198 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7199 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7200 CVec_u8Z_free(ret_var);
7204 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
7205 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
7206 for (size_t i = 0; i < ret.datalen; i++) {
7207 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
7211 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7212 return ThirtyTwoBytes_clone(&owner->a);
7214 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7215 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
7216 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7217 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data);
7221 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7222 return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
7224 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7225 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(owner & ~1);
7226 LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
7227 int64_tArray ret_arr = NULL;
7228 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7229 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7230 for (size_t v = 0; v < ret_var.datalen; v++) {
7231 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7232 *ret_conv_21_conv = ret_var.data[v];
7233 ret_arr_ptr[v] = ((int64_t)ret_conv_21_conv);
7235 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7240 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
7241 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 };
7242 for (size_t i = 0; i < ret.datalen; i++) {
7243 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
7247 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
7248 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
7249 for (size_t i = 0; i < ret.datalen; i++) {
7250 ret.data[i] = Event_clone(&orig->data[i]);
7254 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7257 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7258 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
7259 int32_t ret_val = C2Tuple_u32TxOutZ_get_a(owner_conv);
7263 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
7264 return TxOut_clone(&owner->b);
7266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7267 LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)(owner & ~1);
7268 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
7269 *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
7270 return (int64_t)ret_ref;
7273 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
7274 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
7275 for (size_t i = 0; i < ret.datalen; i++) {
7276 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
7280 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7281 return ThirtyTwoBytes_clone(&owner->a);
7283 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7284 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
7285 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
7286 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
7290 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
7291 return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
7293 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7294 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(owner & ~1);
7295 LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
7296 int64_tArray ret_arr = NULL;
7297 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7298 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7299 for (size_t u = 0; u < ret_var.datalen; u++) {
7300 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
7301 *ret_conv_20_conv = ret_var.data[u];
7302 ret_arr_ptr[u] = ((int64_t)ret_conv_20_conv);
7304 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7309 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
7310 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 };
7311 for (size_t i = 0; i < ret.datalen; i++) {
7312 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
7316 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
7317 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
7318 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
7319 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
7320 static jclass LDKBalance_ContentiousClaimable_class = NULL;
7321 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
7322 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
7323 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
7324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
7325 LDKBalance_ClaimableOnChannelClose_class =
7326 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
7327 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
7328 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
7329 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
7330 LDKBalance_ClaimableAwaitingConfirmations_class =
7331 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
7332 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
7333 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
7334 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
7335 LDKBalance_ContentiousClaimable_class =
7336 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
7337 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
7338 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
7339 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
7340 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
7341 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout"));
7342 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
7343 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
7344 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
7346 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7347 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
7349 case LDKBalance_ClaimableOnChannelClose: {
7350 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
7352 case LDKBalance_ClaimableAwaitingConfirmations: {
7353 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
7355 case LDKBalance_ContentiousClaimable: {
7356 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
7358 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
7359 return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis, obj->maybe_claimable_htlc_awaiting_timeout.claimable_height);
7364 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
7365 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
7366 for (size_t i = 0; i < ret.datalen; i++) {
7367 ret.data[i] = Balance_clone(&orig->data[i]);
7371 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7372 CHECK(owner->result_ok);
7373 return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
7375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7376 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
7377 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
7378 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
7379 return ((int64_t)ret_conv);
7382 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
7383 CHECK(!owner->result_ok);
7384 return DecodeError_clone(&*owner->contents.err);
7386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7387 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(owner & ~1);
7388 LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
7389 int64_t ret_ref = 0;
7390 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7391 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7392 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7393 ret_ref = (uintptr_t)ret_var.inner;
7394 if (ret_var.is_owned) {
7400 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
7401 CHECK(owner->result_ok);
7402 return *owner->contents.result;
7404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7405 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
7406 CResult_NoneLightningErrorZ_get_ok(owner_conv);
7409 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
7410 CHECK(!owner->result_ok);
7411 return LightningError_clone(&*owner->contents.err);
7413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7414 LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)(owner & ~1);
7415 LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
7416 int64_t ret_ref = 0;
7417 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7418 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7420 ret_ref = (uintptr_t)ret_var.inner;
7421 if (ret_var.is_owned) {
7427 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7431 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
7432 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
7433 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
7437 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
7438 return Type_clone(&owner->b);
7440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7441 LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)(owner & ~1);
7442 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
7443 *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
7444 return (int64_t)ret_ret;
7447 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
7448 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
7449 for (size_t i = 0; i < ret.datalen; i++) {
7450 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
7454 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
7455 CHECK(owner->result_ok);
7456 return *owner->contents.result;
7458 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7459 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
7460 jboolean ret_val = CResult_boolLightningErrorZ_get_ok(owner_conv);
7464 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
7465 CHECK(!owner->result_ok);
7466 return LightningError_clone(&*owner->contents.err);
7468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7469 LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)(owner & ~1);
7470 LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
7471 int64_t ret_ref = 0;
7472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7475 ret_ref = (uintptr_t)ret_var.inner;
7476 if (ret_var.is_owned) {
7482 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7483 return ChannelAnnouncement_clone(&owner->a);
7485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7486 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7487 LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
7488 int64_t ret_ref = 0;
7489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7492 ret_ref = (uintptr_t)ret_var.inner;
7493 if (ret_var.is_owned) {
7499 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7500 return ChannelUpdate_clone(&owner->b);
7502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7503 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7504 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
7505 int64_t ret_ref = 0;
7506 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7507 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7508 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7509 ret_ref = (uintptr_t)ret_var.inner;
7510 if (ret_var.is_owned) {
7516 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
7517 return ChannelUpdate_clone(&owner->c);
7519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
7520 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(owner & ~1);
7521 LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
7522 int64_t ret_ref = 0;
7523 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7524 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7525 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7526 ret_ref = (uintptr_t)ret_var.inner;
7527 if (ret_var.is_owned) {
7533 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
7534 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
7535 for (size_t i = 0; i < ret.datalen; i++) {
7536 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
7540 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
7541 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
7542 for (size_t i = 0; i < ret.datalen; i++) {
7543 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
7547 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7548 CHECK(owner->result_ok);
7549 return CVec_u8Z_clone(&*owner->contents.result);
7551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7552 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
7553 LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
7554 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
7555 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
7556 CVec_u8Z_free(ret_var);
7560 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
7561 CHECK(!owner->result_ok);
7562 return PeerHandleError_clone(&*owner->contents.err);
7564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7565 LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(owner & ~1);
7566 LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
7567 int64_t ret_ref = 0;
7568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7571 ret_ref = (uintptr_t)ret_var.inner;
7572 if (ret_var.is_owned) {
7578 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7579 CHECK(owner->result_ok);
7580 return *owner->contents.result;
7582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7583 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
7584 CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
7587 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
7588 CHECK(!owner->result_ok);
7589 return PeerHandleError_clone(&*owner->contents.err);
7591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7592 LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)(owner & ~1);
7593 LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
7594 int64_t ret_ref = 0;
7595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7598 ret_ref = (uintptr_t)ret_var.inner;
7599 if (ret_var.is_owned) {
7605 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7606 CHECK(owner->result_ok);
7607 return *owner->contents.result;
7609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7610 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
7611 jboolean ret_val = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
7615 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
7616 CHECK(!owner->result_ok);
7617 return PeerHandleError_clone(&*owner->contents.err);
7619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7620 LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)(owner & ~1);
7621 LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
7622 int64_t ret_ref = 0;
7623 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7624 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7626 ret_ref = (uintptr_t)ret_var.inner;
7627 if (ret_var.is_owned) {
7633 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
7634 CHECK(owner->result_ok);
7635 return NodeId_clone(&*owner->contents.result);
7637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7638 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
7639 LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
7640 int64_t ret_ref = 0;
7641 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7642 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7643 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7644 ret_ref = (uintptr_t)ret_var.inner;
7645 if (ret_var.is_owned) {
7651 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
7652 CHECK(!owner->result_ok);
7653 return DecodeError_clone(&*owner->contents.err);
7655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7656 LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)(owner & ~1);
7657 LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
7658 int64_t ret_ref = 0;
7659 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7660 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7662 ret_ref = (uintptr_t)ret_var.inner;
7663 if (ret_var.is_owned) {
7669 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
7670 CHECK(owner->result_ok);
7671 return COption_NetworkUpdateZ_clone(&*owner->contents.result);
7673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7674 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
7675 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
7676 *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
7677 int64_t ret_ref = (uintptr_t)ret_copy;
7681 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
7682 CHECK(!owner->result_ok);
7683 return DecodeError_clone(&*owner->contents.err);
7685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7686 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(owner & ~1);
7687 LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
7688 int64_t ret_ref = 0;
7689 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7690 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7691 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7692 ret_ref = (uintptr_t)ret_var.inner;
7693 if (ret_var.is_owned) {
7699 typedef struct LDKAccess_JCalls {
7700 atomic_size_t refcnt;
7703 jmethodID get_utxo_meth;
7705 static void LDKAccess_JCalls_free(void* this_arg) {
7706 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
7707 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7709 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7710 if (get_jenv_res == JNI_EDETACHED) {
7711 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7713 DO_ASSERT(get_jenv_res == JNI_OK);
7715 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7716 if (get_jenv_res == JNI_EDETACHED) {
7717 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7722 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
7723 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
7725 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7726 if (get_jenv_res == JNI_EDETACHED) {
7727 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7729 DO_ASSERT(get_jenv_res == JNI_OK);
7731 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
7732 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
7733 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7735 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
7736 if (UNLIKELY((*env)->ExceptionCheck(env))) {
7737 (*env)->ExceptionDescribe(env);
7738 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
7740 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
7741 CHECK_ACCESS(ret_ptr);
7742 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
7744 if (get_jenv_res == JNI_EDETACHED) {
7745 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7749 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
7750 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
7751 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7753 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
7754 jclass c = (*env)->GetObjectClass(env, o);
7756 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
7757 atomic_init(&calls->refcnt, 1);
7758 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7759 calls->o = (*env)->NewWeakGlobalRef(env, o);
7760 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
7761 CHECK(calls->get_utxo_meth != NULL);
7764 .this_arg = (void*) calls,
7765 .get_utxo = get_utxo_LDKAccess_jcall,
7766 .free = LDKAccess_JCalls_free,
7770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
7771 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
7772 *res_ptr = LDKAccess_init(env, clz, o);
7773 return (uint64_t)res_ptr;
7775 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) {
7776 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
7777 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
7778 LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
7779 unsigned char genesis_hash_arr[32];
7780 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
7781 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
7782 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
7783 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
7784 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
7785 return (int64_t)ret_conv;
7788 static jclass LDKCOption_AccessZ_Some_class = NULL;
7789 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
7790 static jclass LDKCOption_AccessZ_None_class = NULL;
7791 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
7792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
7793 LDKCOption_AccessZ_Some_class =
7794 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some"));
7795 CHECK(LDKCOption_AccessZ_Some_class != NULL);
7796 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
7797 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
7798 LDKCOption_AccessZ_None_class =
7799 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None"));
7800 CHECK(LDKCOption_AccessZ_None_class != NULL);
7801 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
7802 CHECK(LDKCOption_AccessZ_None_meth != NULL);
7804 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7805 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
7807 case LDKCOption_AccessZ_Some: {
7808 LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
7809 *some_ret = obj->some;
7810 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
7811 if ((*some_ret).free == LDKAccess_JCalls_free) {
7812 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7813 LDKAccess_JCalls_cloned(&(*some_ret));
7815 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (int64_t)some_ret);
7817 case LDKCOption_AccessZ_None: {
7818 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
7823 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
7824 CHECK(owner->result_ok);
7825 return ChannelUpdateInfo_clone(&*owner->contents.result);
7827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7828 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
7829 LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(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 struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
7842 CHECK(!owner->result_ok);
7843 return DecodeError_clone(&*owner->contents.err);
7845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7846 LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(owner & ~1);
7847 LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
7848 int64_t ret_ref = 0;
7849 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7850 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7851 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7852 ret_ref = (uintptr_t)ret_var.inner;
7853 if (ret_var.is_owned) {
7859 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7860 CHECK(owner->result_ok);
7861 return ChannelInfo_clone(&*owner->contents.result);
7863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7864 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
7865 LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
7866 int64_t ret_ref = 0;
7867 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7868 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7869 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7870 ret_ref = (uintptr_t)ret_var.inner;
7871 if (ret_var.is_owned) {
7877 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7878 CHECK(!owner->result_ok);
7879 return DecodeError_clone(&*owner->contents.err);
7881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7882 LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(owner & ~1);
7883 LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
7884 int64_t ret_ref = 0;
7885 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7886 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7887 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7888 ret_ref = (uintptr_t)ret_var.inner;
7889 if (ret_var.is_owned) {
7895 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7896 CHECK(owner->result_ok);
7897 return RoutingFees_clone(&*owner->contents.result);
7899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7900 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
7901 LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
7902 int64_t ret_ref = 0;
7903 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7904 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7906 ret_ref = (uintptr_t)ret_var.inner;
7907 if (ret_var.is_owned) {
7913 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7914 CHECK(!owner->result_ok);
7915 return DecodeError_clone(&*owner->contents.err);
7917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7918 LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(owner & ~1);
7919 LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
7920 int64_t ret_ref = 0;
7921 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7922 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7924 ret_ref = (uintptr_t)ret_var.inner;
7925 if (ret_var.is_owned) {
7931 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7932 CHECK(owner->result_ok);
7933 return NodeAnnouncementInfo_clone(&*owner->contents.result);
7935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7936 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
7937 LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
7938 int64_t ret_ref = 0;
7939 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7940 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7942 ret_ref = (uintptr_t)ret_var.inner;
7943 if (ret_var.is_owned) {
7949 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7950 CHECK(!owner->result_ok);
7951 return DecodeError_clone(&*owner->contents.err);
7953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7954 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(owner & ~1);
7955 LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
7956 int64_t ret_ref = 0;
7957 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7958 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7960 ret_ref = (uintptr_t)ret_var.inner;
7961 if (ret_var.is_owned) {
7967 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
7968 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
7969 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
7972 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7973 CHECK(owner->result_ok);
7974 return NodeInfo_clone(&*owner->contents.result);
7976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7977 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
7978 LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
7979 int64_t ret_ref = 0;
7980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7983 ret_ref = (uintptr_t)ret_var.inner;
7984 if (ret_var.is_owned) {
7990 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7991 CHECK(!owner->result_ok);
7992 return DecodeError_clone(&*owner->contents.err);
7994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7995 LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(owner & ~1);
7996 LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
7997 int64_t ret_ref = 0;
7998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8001 ret_ref = (uintptr_t)ret_var.inner;
8002 if (ret_var.is_owned) {
8008 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
8009 CHECK(owner->result_ok);
8010 return NetworkGraph_clone(&*owner->contents.result);
8012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8013 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
8014 LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
8015 int64_t ret_ref = 0;
8016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8019 ret_ref = (uintptr_t)ret_var.inner;
8020 if (ret_var.is_owned) {
8026 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
8027 CHECK(!owner->result_ok);
8028 return DecodeError_clone(&*owner->contents.err);
8030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8031 LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(owner & ~1);
8032 LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
8033 int64_t ret_ref = 0;
8034 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8035 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8036 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8037 ret_ref = (uintptr_t)ret_var.inner;
8038 if (ret_var.is_owned) {
8044 static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL;
8045 static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL;
8046 static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL;
8047 static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL;
8048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) {
8049 LDKCOption_CVec_NetAddressZZ_Some_class =
8050 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some"));
8051 CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL);
8052 LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "<init>", "([J)V");
8053 CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL);
8054 LDKCOption_CVec_NetAddressZZ_None_class =
8055 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None"));
8056 CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL);
8057 LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "<init>", "()V");
8058 CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL);
8060 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8061 LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1);
8063 case LDKCOption_CVec_NetAddressZZ_Some: {
8064 LDKCVec_NetAddressZ some_var = obj->some;
8065 int64_tArray some_arr = NULL;
8066 some_arr = (*env)->NewLongArray(env, some_var.datalen);
8067 int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
8068 for (size_t m = 0; m < some_var.datalen; m++) {
8069 int64_t some_conv_12_ref = ((uintptr_t)&some_var.data[m]) | 1;
8070 some_arr_ptr[m] = some_conv_12_ref;
8072 (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
8073 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr);
8075 case LDKCOption_CVec_NetAddressZZ_None: {
8076 return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth);
8081 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8082 CHECK(owner->result_ok);
8083 return NetAddress_clone(&*owner->contents.result);
8085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8086 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8087 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8088 *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8089 int64_t ret_ref = (uintptr_t)ret_copy;
8093 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8094 CHECK(!owner->result_ok);
8095 return DecodeError_clone(&*owner->contents.err);
8097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8098 LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)(owner & ~1);
8099 LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8100 int64_t ret_ref = 0;
8101 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8102 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8103 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8104 ret_ref = (uintptr_t)ret_var.inner;
8105 if (ret_var.is_owned) {
8111 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8112 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8113 for (size_t i = 0; i < ret.datalen; i++) {
8114 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8118 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8119 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8120 for (size_t i = 0; i < ret.datalen; i++) {
8121 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8125 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8126 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8127 for (size_t i = 0; i < ret.datalen; i++) {
8128 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8132 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8133 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8134 for (size_t i = 0; i < ret.datalen; i++) {
8135 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8139 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8140 CHECK(owner->result_ok);
8141 return AcceptChannel_clone(&*owner->contents.result);
8143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8144 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8145 LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8146 int64_t ret_ref = 0;
8147 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8148 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8149 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8150 ret_ref = (uintptr_t)ret_var.inner;
8151 if (ret_var.is_owned) {
8157 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8158 CHECK(!owner->result_ok);
8159 return DecodeError_clone(&*owner->contents.err);
8161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8162 LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(owner & ~1);
8163 LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8164 int64_t ret_ref = 0;
8165 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8166 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8168 ret_ref = (uintptr_t)ret_var.inner;
8169 if (ret_var.is_owned) {
8175 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8176 CHECK(owner->result_ok);
8177 return AnnouncementSignatures_clone(&*owner->contents.result);
8179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8180 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8181 LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
8182 int64_t ret_ref = 0;
8183 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8184 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8185 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8186 ret_ref = (uintptr_t)ret_var.inner;
8187 if (ret_var.is_owned) {
8193 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
8194 CHECK(!owner->result_ok);
8195 return DecodeError_clone(&*owner->contents.err);
8197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8198 LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(owner & ~1);
8199 LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
8200 int64_t ret_ref = 0;
8201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8204 ret_ref = (uintptr_t)ret_var.inner;
8205 if (ret_var.is_owned) {
8211 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8212 CHECK(owner->result_ok);
8213 return ChannelReestablish_clone(&*owner->contents.result);
8215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8216 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8217 LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
8218 int64_t ret_ref = 0;
8219 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8220 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8221 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8222 ret_ref = (uintptr_t)ret_var.inner;
8223 if (ret_var.is_owned) {
8229 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
8230 CHECK(!owner->result_ok);
8231 return DecodeError_clone(&*owner->contents.err);
8233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8234 LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(owner & ~1);
8235 LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
8236 int64_t ret_ref = 0;
8237 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8238 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8239 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8240 ret_ref = (uintptr_t)ret_var.inner;
8241 if (ret_var.is_owned) {
8247 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8248 CHECK(owner->result_ok);
8249 return ClosingSigned_clone(&*owner->contents.result);
8251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8252 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8253 LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
8254 int64_t ret_ref = 0;
8255 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8256 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8257 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8258 ret_ref = (uintptr_t)ret_var.inner;
8259 if (ret_var.is_owned) {
8265 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
8266 CHECK(!owner->result_ok);
8267 return DecodeError_clone(&*owner->contents.err);
8269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8270 LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(owner & ~1);
8271 LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
8272 int64_t ret_ref = 0;
8273 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8274 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8275 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8276 ret_ref = (uintptr_t)ret_var.inner;
8277 if (ret_var.is_owned) {
8283 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8284 CHECK(owner->result_ok);
8285 return ClosingSignedFeeRange_clone(&*owner->contents.result);
8287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8288 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8289 LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
8290 int64_t ret_ref = 0;
8291 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8292 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8293 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8294 ret_ref = (uintptr_t)ret_var.inner;
8295 if (ret_var.is_owned) {
8301 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
8302 CHECK(!owner->result_ok);
8303 return DecodeError_clone(&*owner->contents.err);
8305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8306 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(owner & ~1);
8307 LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
8308 int64_t ret_ref = 0;
8309 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8310 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8311 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8312 ret_ref = (uintptr_t)ret_var.inner;
8313 if (ret_var.is_owned) {
8319 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8320 CHECK(owner->result_ok);
8321 return CommitmentSigned_clone(&*owner->contents.result);
8323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8324 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8325 LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
8326 int64_t ret_ref = 0;
8327 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8328 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8329 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8330 ret_ref = (uintptr_t)ret_var.inner;
8331 if (ret_var.is_owned) {
8337 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
8338 CHECK(!owner->result_ok);
8339 return DecodeError_clone(&*owner->contents.err);
8341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8342 LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(owner & ~1);
8343 LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
8344 int64_t ret_ref = 0;
8345 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8346 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8347 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8348 ret_ref = (uintptr_t)ret_var.inner;
8349 if (ret_var.is_owned) {
8355 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8356 CHECK(owner->result_ok);
8357 return FundingCreated_clone(&*owner->contents.result);
8359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8360 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8361 LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
8362 int64_t ret_ref = 0;
8363 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8364 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8366 ret_ref = (uintptr_t)ret_var.inner;
8367 if (ret_var.is_owned) {
8373 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
8374 CHECK(!owner->result_ok);
8375 return DecodeError_clone(&*owner->contents.err);
8377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8378 LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(owner & ~1);
8379 LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
8380 int64_t ret_ref = 0;
8381 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8382 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8384 ret_ref = (uintptr_t)ret_var.inner;
8385 if (ret_var.is_owned) {
8391 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8392 CHECK(owner->result_ok);
8393 return FundingSigned_clone(&*owner->contents.result);
8395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8396 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8397 LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
8398 int64_t ret_ref = 0;
8399 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8400 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8401 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8402 ret_ref = (uintptr_t)ret_var.inner;
8403 if (ret_var.is_owned) {
8409 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
8410 CHECK(!owner->result_ok);
8411 return DecodeError_clone(&*owner->contents.err);
8413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8414 LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(owner & ~1);
8415 LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
8416 int64_t ret_ref = 0;
8417 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8418 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8419 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8420 ret_ref = (uintptr_t)ret_var.inner;
8421 if (ret_var.is_owned) {
8427 static inline struct LDKFundingLocked CResult_FundingLockedDecodeErrorZ_get_ok(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
8428 CHECK(owner->result_ok);
8429 return FundingLocked_clone(&*owner->contents.result);
8431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8432 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
8433 LDKFundingLocked ret_var = CResult_FundingLockedDecodeErrorZ_get_ok(owner_conv);
8434 int64_t ret_ref = 0;
8435 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8436 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8437 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8438 ret_ref = (uintptr_t)ret_var.inner;
8439 if (ret_var.is_owned) {
8445 static inline struct LDKDecodeError CResult_FundingLockedDecodeErrorZ_get_err(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR owner){
8446 CHECK(!owner->result_ok);
8447 return DecodeError_clone(&*owner->contents.err);
8449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8450 LDKCResult_FundingLockedDecodeErrorZ* owner_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(owner & ~1);
8451 LDKDecodeError ret_var = CResult_FundingLockedDecodeErrorZ_get_err(owner_conv);
8452 int64_t ret_ref = 0;
8453 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8454 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8455 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8456 ret_ref = (uintptr_t)ret_var.inner;
8457 if (ret_var.is_owned) {
8463 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8464 CHECK(owner->result_ok);
8465 return Init_clone(&*owner->contents.result);
8467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8468 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
8469 LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
8470 int64_t ret_ref = 0;
8471 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8472 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8474 ret_ref = (uintptr_t)ret_var.inner;
8475 if (ret_var.is_owned) {
8481 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
8482 CHECK(!owner->result_ok);
8483 return DecodeError_clone(&*owner->contents.err);
8485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8486 LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)(owner & ~1);
8487 LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
8488 int64_t ret_ref = 0;
8489 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8490 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8491 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8492 ret_ref = (uintptr_t)ret_var.inner;
8493 if (ret_var.is_owned) {
8499 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8500 CHECK(owner->result_ok);
8501 return OpenChannel_clone(&*owner->contents.result);
8503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8504 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8505 LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
8506 int64_t ret_ref = 0;
8507 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8508 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8510 ret_ref = (uintptr_t)ret_var.inner;
8511 if (ret_var.is_owned) {
8517 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
8518 CHECK(!owner->result_ok);
8519 return DecodeError_clone(&*owner->contents.err);
8521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8522 LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(owner & ~1);
8523 LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
8524 int64_t ret_ref = 0;
8525 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8526 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8527 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8528 ret_ref = (uintptr_t)ret_var.inner;
8529 if (ret_var.is_owned) {
8535 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8536 CHECK(owner->result_ok);
8537 return RevokeAndACK_clone(&*owner->contents.result);
8539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8540 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8541 LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
8542 int64_t ret_ref = 0;
8543 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8544 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8545 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8546 ret_ref = (uintptr_t)ret_var.inner;
8547 if (ret_var.is_owned) {
8553 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
8554 CHECK(!owner->result_ok);
8555 return DecodeError_clone(&*owner->contents.err);
8557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8558 LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(owner & ~1);
8559 LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
8560 int64_t ret_ref = 0;
8561 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8562 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8563 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8564 ret_ref = (uintptr_t)ret_var.inner;
8565 if (ret_var.is_owned) {
8571 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8572 CHECK(owner->result_ok);
8573 return Shutdown_clone(&*owner->contents.result);
8575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8576 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
8577 LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
8578 int64_t ret_ref = 0;
8579 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8580 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8581 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8582 ret_ref = (uintptr_t)ret_var.inner;
8583 if (ret_var.is_owned) {
8589 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
8590 CHECK(!owner->result_ok);
8591 return DecodeError_clone(&*owner->contents.err);
8593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8594 LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)(owner & ~1);
8595 LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
8596 int64_t ret_ref = 0;
8597 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8598 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8599 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8600 ret_ref = (uintptr_t)ret_var.inner;
8601 if (ret_var.is_owned) {
8607 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8608 CHECK(owner->result_ok);
8609 return UpdateFailHTLC_clone(&*owner->contents.result);
8611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8612 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
8613 LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
8614 int64_t ret_ref = 0;
8615 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8616 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8617 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8618 ret_ref = (uintptr_t)ret_var.inner;
8619 if (ret_var.is_owned) {
8625 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
8626 CHECK(!owner->result_ok);
8627 return DecodeError_clone(&*owner->contents.err);
8629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8630 LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(owner & ~1);
8631 LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
8632 int64_t ret_ref = 0;
8633 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8634 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8635 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8636 ret_ref = (uintptr_t)ret_var.inner;
8637 if (ret_var.is_owned) {
8643 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8644 CHECK(owner->result_ok);
8645 return UpdateFailMalformedHTLC_clone(&*owner->contents.result);
8647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8648 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
8649 LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
8650 int64_t ret_ref = 0;
8651 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8652 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8653 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8654 ret_ref = (uintptr_t)ret_var.inner;
8655 if (ret_var.is_owned) {
8661 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
8662 CHECK(!owner->result_ok);
8663 return DecodeError_clone(&*owner->contents.err);
8665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8666 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(owner & ~1);
8667 LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
8668 int64_t ret_ref = 0;
8669 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8670 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8671 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8672 ret_ref = (uintptr_t)ret_var.inner;
8673 if (ret_var.is_owned) {
8679 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8680 CHECK(owner->result_ok);
8681 return UpdateFee_clone(&*owner->contents.result);
8683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8684 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
8685 LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
8686 int64_t ret_ref = 0;
8687 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8688 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8689 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8690 ret_ref = (uintptr_t)ret_var.inner;
8691 if (ret_var.is_owned) {
8697 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
8698 CHECK(!owner->result_ok);
8699 return DecodeError_clone(&*owner->contents.err);
8701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8702 LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(owner & ~1);
8703 LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
8704 int64_t ret_ref = 0;
8705 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8706 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8708 ret_ref = (uintptr_t)ret_var.inner;
8709 if (ret_var.is_owned) {
8715 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8716 CHECK(owner->result_ok);
8717 return UpdateFulfillHTLC_clone(&*owner->contents.result);
8719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8720 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
8721 LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
8722 int64_t ret_ref = 0;
8723 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8724 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8725 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8726 ret_ref = (uintptr_t)ret_var.inner;
8727 if (ret_var.is_owned) {
8733 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
8734 CHECK(!owner->result_ok);
8735 return DecodeError_clone(&*owner->contents.err);
8737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8738 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(owner & ~1);
8739 LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
8740 int64_t ret_ref = 0;
8741 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8742 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8743 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8744 ret_ref = (uintptr_t)ret_var.inner;
8745 if (ret_var.is_owned) {
8751 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8752 CHECK(owner->result_ok);
8753 return UpdateAddHTLC_clone(&*owner->contents.result);
8755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8756 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
8757 LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
8758 int64_t ret_ref = 0;
8759 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8760 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8761 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8762 ret_ref = (uintptr_t)ret_var.inner;
8763 if (ret_var.is_owned) {
8769 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
8770 CHECK(!owner->result_ok);
8771 return DecodeError_clone(&*owner->contents.err);
8773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8774 LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(owner & ~1);
8775 LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
8776 int64_t ret_ref = 0;
8777 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8778 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8779 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8780 ret_ref = (uintptr_t)ret_var.inner;
8781 if (ret_var.is_owned) {
8787 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8788 CHECK(owner->result_ok);
8789 return Ping_clone(&*owner->contents.result);
8791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8792 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
8793 LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
8794 int64_t ret_ref = 0;
8795 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8796 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8797 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8798 ret_ref = (uintptr_t)ret_var.inner;
8799 if (ret_var.is_owned) {
8805 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
8806 CHECK(!owner->result_ok);
8807 return DecodeError_clone(&*owner->contents.err);
8809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8810 LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)(owner & ~1);
8811 LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
8812 int64_t ret_ref = 0;
8813 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8814 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8815 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8816 ret_ref = (uintptr_t)ret_var.inner;
8817 if (ret_var.is_owned) {
8823 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8824 CHECK(owner->result_ok);
8825 return Pong_clone(&*owner->contents.result);
8827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8828 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
8829 LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
8830 int64_t ret_ref = 0;
8831 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8832 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8833 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8834 ret_ref = (uintptr_t)ret_var.inner;
8835 if (ret_var.is_owned) {
8841 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
8842 CHECK(!owner->result_ok);
8843 return DecodeError_clone(&*owner->contents.err);
8845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8846 LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)(owner & ~1);
8847 LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
8848 int64_t ret_ref = 0;
8849 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8850 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8851 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8852 ret_ref = (uintptr_t)ret_var.inner;
8853 if (ret_var.is_owned) {
8859 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8860 CHECK(owner->result_ok);
8861 return UnsignedChannelAnnouncement_clone(&*owner->contents.result);
8863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8864 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8865 LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8866 int64_t ret_ref = 0;
8867 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8868 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8869 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8870 ret_ref = (uintptr_t)ret_var.inner;
8871 if (ret_var.is_owned) {
8877 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8878 CHECK(!owner->result_ok);
8879 return DecodeError_clone(&*owner->contents.err);
8881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8882 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8883 LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8884 int64_t ret_ref = 0;
8885 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8886 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8887 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8888 ret_ref = (uintptr_t)ret_var.inner;
8889 if (ret_var.is_owned) {
8895 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8896 CHECK(owner->result_ok);
8897 return ChannelAnnouncement_clone(&*owner->contents.result);
8899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8900 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8901 LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
8902 int64_t ret_ref = 0;
8903 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8904 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8905 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8906 ret_ref = (uintptr_t)ret_var.inner;
8907 if (ret_var.is_owned) {
8913 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
8914 CHECK(!owner->result_ok);
8915 return DecodeError_clone(&*owner->contents.err);
8917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8918 LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(owner & ~1);
8919 LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
8920 int64_t ret_ref = 0;
8921 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8922 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8923 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8924 ret_ref = (uintptr_t)ret_var.inner;
8925 if (ret_var.is_owned) {
8931 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8932 CHECK(owner->result_ok);
8933 return UnsignedChannelUpdate_clone(&*owner->contents.result);
8935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8936 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
8937 LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8938 int64_t ret_ref = 0;
8939 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8940 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8942 ret_ref = (uintptr_t)ret_var.inner;
8943 if (ret_var.is_owned) {
8949 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8950 CHECK(!owner->result_ok);
8951 return DecodeError_clone(&*owner->contents.err);
8953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8954 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(owner & ~1);
8955 LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
8956 int64_t ret_ref = 0;
8957 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8958 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8959 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8960 ret_ref = (uintptr_t)ret_var.inner;
8961 if (ret_var.is_owned) {
8967 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8968 CHECK(owner->result_ok);
8969 return ChannelUpdate_clone(&*owner->contents.result);
8971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8972 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
8973 LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
8974 int64_t ret_ref = 0;
8975 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8976 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8978 ret_ref = (uintptr_t)ret_var.inner;
8979 if (ret_var.is_owned) {
8985 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
8986 CHECK(!owner->result_ok);
8987 return DecodeError_clone(&*owner->contents.err);
8989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8990 LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(owner & ~1);
8991 LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
8992 int64_t ret_ref = 0;
8993 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8994 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8995 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8996 ret_ref = (uintptr_t)ret_var.inner;
8997 if (ret_var.is_owned) {
9003 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9004 CHECK(owner->result_ok);
9005 return ErrorMessage_clone(&*owner->contents.result);
9007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9008 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9009 LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9010 int64_t ret_ref = 0;
9011 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9012 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9013 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9014 ret_ref = (uintptr_t)ret_var.inner;
9015 if (ret_var.is_owned) {
9021 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9022 CHECK(!owner->result_ok);
9023 return DecodeError_clone(&*owner->contents.err);
9025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9026 LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(owner & ~1);
9027 LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9028 int64_t ret_ref = 0;
9029 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9030 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9031 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9032 ret_ref = (uintptr_t)ret_var.inner;
9033 if (ret_var.is_owned) {
9039 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9040 CHECK(owner->result_ok);
9041 return WarningMessage_clone(&*owner->contents.result);
9043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9044 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9045 LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9046 int64_t ret_ref = 0;
9047 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9048 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9049 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9050 ret_ref = (uintptr_t)ret_var.inner;
9051 if (ret_var.is_owned) {
9057 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9058 CHECK(!owner->result_ok);
9059 return DecodeError_clone(&*owner->contents.err);
9061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9062 LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(owner & ~1);
9063 LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9064 int64_t ret_ref = 0;
9065 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9066 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9067 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9068 ret_ref = (uintptr_t)ret_var.inner;
9069 if (ret_var.is_owned) {
9075 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9076 CHECK(owner->result_ok);
9077 return UnsignedNodeAnnouncement_clone(&*owner->contents.result);
9079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9080 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9081 LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9082 int64_t ret_ref = 0;
9083 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9084 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9085 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9086 ret_ref = (uintptr_t)ret_var.inner;
9087 if (ret_var.is_owned) {
9093 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9094 CHECK(!owner->result_ok);
9095 return DecodeError_clone(&*owner->contents.err);
9097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9098 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(owner & ~1);
9099 LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9100 int64_t ret_ref = 0;
9101 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9102 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9103 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9104 ret_ref = (uintptr_t)ret_var.inner;
9105 if (ret_var.is_owned) {
9111 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9112 CHECK(owner->result_ok);
9113 return NodeAnnouncement_clone(&*owner->contents.result);
9115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9116 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9117 LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9118 int64_t ret_ref = 0;
9119 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9120 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9121 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9122 ret_ref = (uintptr_t)ret_var.inner;
9123 if (ret_var.is_owned) {
9129 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9130 CHECK(!owner->result_ok);
9131 return DecodeError_clone(&*owner->contents.err);
9133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9134 LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(owner & ~1);
9135 LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9136 int64_t ret_ref = 0;
9137 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9138 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9139 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9140 ret_ref = (uintptr_t)ret_var.inner;
9141 if (ret_var.is_owned) {
9147 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9148 CHECK(owner->result_ok);
9149 return QueryShortChannelIds_clone(&*owner->contents.result);
9151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9152 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9153 LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9154 int64_t ret_ref = 0;
9155 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9156 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9158 ret_ref = (uintptr_t)ret_var.inner;
9159 if (ret_var.is_owned) {
9165 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9166 CHECK(!owner->result_ok);
9167 return DecodeError_clone(&*owner->contents.err);
9169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9170 LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(owner & ~1);
9171 LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9172 int64_t ret_ref = 0;
9173 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9174 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9175 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9176 ret_ref = (uintptr_t)ret_var.inner;
9177 if (ret_var.is_owned) {
9183 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9184 CHECK(owner->result_ok);
9185 return ReplyShortChannelIdsEnd_clone(&*owner->contents.result);
9187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9188 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9189 LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9190 int64_t ret_ref = 0;
9191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9194 ret_ref = (uintptr_t)ret_var.inner;
9195 if (ret_var.is_owned) {
9201 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9202 CHECK(!owner->result_ok);
9203 return DecodeError_clone(&*owner->contents.err);
9205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9206 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(owner & ~1);
9207 LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9208 int64_t ret_ref = 0;
9209 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9210 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9211 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9212 ret_ref = (uintptr_t)ret_var.inner;
9213 if (ret_var.is_owned) {
9219 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9220 CHECK(owner->result_ok);
9221 return QueryChannelRange_clone(&*owner->contents.result);
9223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9224 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9225 LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9226 int64_t ret_ref = 0;
9227 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9228 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9229 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9230 ret_ref = (uintptr_t)ret_var.inner;
9231 if (ret_var.is_owned) {
9237 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9238 CHECK(!owner->result_ok);
9239 return DecodeError_clone(&*owner->contents.err);
9241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9242 LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(owner & ~1);
9243 LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9244 int64_t ret_ref = 0;
9245 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9246 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9247 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9248 ret_ref = (uintptr_t)ret_var.inner;
9249 if (ret_var.is_owned) {
9255 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9256 CHECK(owner->result_ok);
9257 return ReplyChannelRange_clone(&*owner->contents.result);
9259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9260 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9261 LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9262 int64_t ret_ref = 0;
9263 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9264 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9266 ret_ref = (uintptr_t)ret_var.inner;
9267 if (ret_var.is_owned) {
9273 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9274 CHECK(!owner->result_ok);
9275 return DecodeError_clone(&*owner->contents.err);
9277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9278 LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(owner & ~1);
9279 LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9280 int64_t ret_ref = 0;
9281 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9282 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9283 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9284 ret_ref = (uintptr_t)ret_var.inner;
9285 if (ret_var.is_owned) {
9291 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9292 CHECK(owner->result_ok);
9293 return GossipTimestampFilter_clone(&*owner->contents.result);
9295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9296 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9297 LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9298 int64_t ret_ref = 0;
9299 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9300 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9302 ret_ref = (uintptr_t)ret_var.inner;
9303 if (ret_var.is_owned) {
9309 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9310 CHECK(!owner->result_ok);
9311 return DecodeError_clone(&*owner->contents.err);
9313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9314 LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(owner & ~1);
9315 LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9316 int64_t ret_ref = 0;
9317 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9318 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9319 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9320 ret_ref = (uintptr_t)ret_var.inner;
9321 if (ret_var.is_owned) {
9327 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
9328 LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
9329 for (size_t i = 0; i < ret.datalen; i++) {
9330 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
9334 static jclass LDKSignOrCreationError_SignError_class = NULL;
9335 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
9336 static jclass LDKSignOrCreationError_CreationError_class = NULL;
9337 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
9338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
9339 LDKSignOrCreationError_SignError_class =
9340 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
9341 CHECK(LDKSignOrCreationError_SignError_class != NULL);
9342 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
9343 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
9344 LDKSignOrCreationError_CreationError_class =
9345 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
9346 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
9347 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
9348 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
9350 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9351 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
9353 case LDKSignOrCreationError_SignError: {
9354 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
9356 case LDKSignOrCreationError_CreationError: {
9357 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
9358 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
9363 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9364 CHECK(owner->result_ok);
9365 return Invoice_clone(&*owner->contents.result);
9367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9368 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9369 LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
9370 int64_t ret_ref = 0;
9371 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9372 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9373 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9374 ret_ref = (uintptr_t)ret_var.inner;
9375 if (ret_var.is_owned) {
9381 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
9382 CHECK(!owner->result_ok);
9383 return SignOrCreationError_clone(&*owner->contents.err);
9385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9386 LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(owner & ~1);
9387 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
9388 *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
9389 int64_t ret_ref = (uintptr_t)ret_copy;
9393 typedef struct LDKFilter_JCalls {
9394 atomic_size_t refcnt;
9397 jmethodID register_tx_meth;
9398 jmethodID register_output_meth;
9400 static void LDKFilter_JCalls_free(void* this_arg) {
9401 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9402 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9404 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9405 if (get_jenv_res == JNI_EDETACHED) {
9406 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9408 DO_ASSERT(get_jenv_res == JNI_OK);
9410 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9411 if (get_jenv_res == JNI_EDETACHED) {
9412 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9417 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
9418 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9420 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9421 if (get_jenv_res == JNI_EDETACHED) {
9422 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9424 DO_ASSERT(get_jenv_res == JNI_OK);
9426 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
9427 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
9428 LDKu8slice script_pubkey_var = script_pubkey;
9429 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
9430 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
9431 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9433 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
9434 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9435 (*env)->ExceptionDescribe(env);
9436 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
9438 if (get_jenv_res == JNI_EDETACHED) {
9439 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9442 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
9443 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
9445 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9446 if (get_jenv_res == JNI_EDETACHED) {
9447 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9449 DO_ASSERT(get_jenv_res == JNI_OK);
9451 LDKWatchedOutput output_var = output;
9452 int64_t output_ref = 0;
9453 CHECK((((uintptr_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9454 CHECK((((uintptr_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9455 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
9456 output_ref = (uintptr_t)output_var.inner;
9457 if (output_var.is_owned) {
9460 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9462 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
9463 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9464 (*env)->ExceptionDescribe(env);
9465 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
9467 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
9468 CHECK_ACCESS(ret_ptr);
9469 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(ret_ptr);
9471 if (get_jenv_res == JNI_EDETACHED) {
9472 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9476 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
9477 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
9478 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9480 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
9481 jclass c = (*env)->GetObjectClass(env, o);
9483 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
9484 atomic_init(&calls->refcnt, 1);
9485 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9486 calls->o = (*env)->NewWeakGlobalRef(env, o);
9487 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
9488 CHECK(calls->register_tx_meth != NULL);
9489 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
9490 CHECK(calls->register_output_meth != NULL);
9493 .this_arg = (void*) calls,
9494 .register_tx = register_tx_LDKFilter_jcall,
9495 .register_output = register_output_LDKFilter_jcall,
9496 .free = LDKFilter_JCalls_free,
9500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
9501 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
9502 *res_ptr = LDKFilter_init(env, clz, o);
9503 return (uint64_t)res_ptr;
9505 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) {
9506 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9507 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9508 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9509 unsigned char txid_arr[32];
9510 CHECK((*env)->GetArrayLength(env, txid) == 32);
9511 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
9512 unsigned char (*txid_ref)[32] = &txid_arr;
9513 LDKu8slice script_pubkey_ref;
9514 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9515 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
9516 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
9517 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
9520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
9521 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9522 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9523 LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
9524 LDKWatchedOutput output_conv;
9525 output_conv.inner = (void*)(output & (~1));
9526 output_conv.is_owned = (output & 1) || (output == 0);
9527 CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
9528 output_conv = WatchedOutput_clone(&output_conv);
9529 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9530 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
9531 int64_t ret_ref = (uintptr_t)ret_copy;
9535 static jclass LDKCOption_FilterZ_Some_class = NULL;
9536 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
9537 static jclass LDKCOption_FilterZ_None_class = NULL;
9538 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
9539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
9540 LDKCOption_FilterZ_Some_class =
9541 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
9542 CHECK(LDKCOption_FilterZ_Some_class != NULL);
9543 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
9544 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
9545 LDKCOption_FilterZ_None_class =
9546 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
9547 CHECK(LDKCOption_FilterZ_None_class != NULL);
9548 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
9549 CHECK(LDKCOption_FilterZ_None_meth != NULL);
9551 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9552 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
9554 case LDKCOption_FilterZ_Some: {
9555 LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
9556 *some_ret = obj->some;
9557 // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
9558 if ((*some_ret).free == LDKFilter_JCalls_free) {
9559 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9560 LDKFilter_JCalls_cloned(&(*some_ret));
9562 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (int64_t)some_ret);
9564 case LDKCOption_FilterZ_None: {
9565 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
9570 static inline struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9571 CHECK(owner->result_ok);
9572 return &*owner->contents.result;
9574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
9575 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
9576 LDKLockedChannelMonitor ret_var = *CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
9577 int64_t ret_ref = 0;
9578 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9579 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9581 ret_ref = (uintptr_t)ret_var.inner & ~1;
9585 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
9586 CHECK(!owner->result_ok);
9587 return *owner->contents.err;
9589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
9590 LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(owner & ~1);
9591 CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
9594 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
9595 LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
9596 for (size_t i = 0; i < ret.datalen; i++) {
9597 ret.data[i] = OutPoint_clone(&orig->data[i]);
9601 typedef struct LDKMessageSendEventsProvider_JCalls {
9602 atomic_size_t refcnt;
9605 jmethodID get_and_clear_pending_msg_events_meth;
9606 } LDKMessageSendEventsProvider_JCalls;
9607 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
9608 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9609 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9611 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9612 if (get_jenv_res == JNI_EDETACHED) {
9613 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9615 DO_ASSERT(get_jenv_res == JNI_OK);
9617 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9618 if (get_jenv_res == JNI_EDETACHED) {
9619 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9624 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
9625 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
9627 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9628 if (get_jenv_res == JNI_EDETACHED) {
9629 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9631 DO_ASSERT(get_jenv_res == JNI_OK);
9633 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9635 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
9636 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9637 (*env)->ExceptionDescribe(env);
9638 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
9640 LDKCVec_MessageSendEventZ ret_constr;
9641 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9642 if (ret_constr.datalen > 0)
9643 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9645 ret_constr.data = NULL;
9646 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9647 for (size_t s = 0; s < ret_constr.datalen; s++) {
9648 int64_t ret_conv_18 = ret_vals[s];
9649 void* ret_conv_18_ptr = (void*)(((uintptr_t)ret_conv_18) & ~1);
9650 CHECK_ACCESS(ret_conv_18_ptr);
9651 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
9652 FREE((void*)ret_conv_18);
9653 ret_constr.data[s] = ret_conv_18_conv;
9655 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9656 if (get_jenv_res == JNI_EDETACHED) {
9657 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9661 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
9662 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
9663 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9665 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9666 jclass c = (*env)->GetObjectClass(env, o);
9668 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
9669 atomic_init(&calls->refcnt, 1);
9670 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9671 calls->o = (*env)->NewWeakGlobalRef(env, o);
9672 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
9673 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
9675 LDKMessageSendEventsProvider ret = {
9676 .this_arg = (void*) calls,
9677 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
9678 .free = LDKMessageSendEventsProvider_JCalls_free,
9682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9683 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9684 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
9685 return (uint64_t)res_ptr;
9687 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
9688 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9689 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9690 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
9691 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
9692 int64_tArray ret_arr = NULL;
9693 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9694 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9695 for (size_t s = 0; s < ret_var.datalen; s++) {
9696 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
9697 *ret_conv_18_copy = ret_var.data[s];
9698 int64_t ret_conv_18_ref = (uintptr_t)ret_conv_18_copy;
9699 ret_arr_ptr[s] = ret_conv_18_ref;
9701 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9706 typedef struct LDKEventHandler_JCalls {
9707 atomic_size_t refcnt;
9710 jmethodID handle_event_meth;
9711 } LDKEventHandler_JCalls;
9712 static void LDKEventHandler_JCalls_free(void* this_arg) {
9713 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9714 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9716 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9717 if (get_jenv_res == JNI_EDETACHED) {
9718 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9720 DO_ASSERT(get_jenv_res == JNI_OK);
9722 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9723 if (get_jenv_res == JNI_EDETACHED) {
9724 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9729 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
9730 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
9732 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9733 if (get_jenv_res == JNI_EDETACHED) {
9734 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9736 DO_ASSERT(get_jenv_res == JNI_OK);
9738 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
9739 *ret_event = Event_clone(event);
9740 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9742 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (int64_t)ret_event);
9743 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9744 (*env)->ExceptionDescribe(env);
9745 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
9747 if (get_jenv_res == JNI_EDETACHED) {
9748 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9751 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
9752 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
9753 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9755 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
9756 jclass c = (*env)->GetObjectClass(env, o);
9758 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
9759 atomic_init(&calls->refcnt, 1);
9760 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9761 calls->o = (*env)->NewWeakGlobalRef(env, o);
9762 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
9763 CHECK(calls->handle_event_meth != NULL);
9765 LDKEventHandler ret = {
9766 .this_arg = (void*) calls,
9767 .handle_event = handle_event_LDKEventHandler_jcall,
9768 .free = LDKEventHandler_JCalls_free,
9772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
9773 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9774 *res_ptr = LDKEventHandler_init(env, clz, o);
9775 return (uint64_t)res_ptr;
9777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
9778 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9779 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9780 LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
9781 LDKEvent* event_conv = (LDKEvent*)event;
9782 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
9785 typedef struct LDKEventsProvider_JCalls {
9786 atomic_size_t refcnt;
9789 jmethodID process_pending_events_meth;
9790 } LDKEventsProvider_JCalls;
9791 static void LDKEventsProvider_JCalls_free(void* this_arg) {
9792 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9793 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9795 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9796 if (get_jenv_res == JNI_EDETACHED) {
9797 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9799 DO_ASSERT(get_jenv_res == JNI_OK);
9801 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9802 if (get_jenv_res == JNI_EDETACHED) {
9803 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9808 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
9809 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
9811 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9812 if (get_jenv_res == JNI_EDETACHED) {
9813 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9815 DO_ASSERT(get_jenv_res == JNI_OK);
9817 LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
9818 *handler_ret = handler;
9819 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9821 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (int64_t)handler_ret);
9822 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9823 (*env)->ExceptionDescribe(env);
9824 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
9826 if (get_jenv_res == JNI_EDETACHED) {
9827 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9830 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
9831 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
9832 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9834 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
9835 jclass c = (*env)->GetObjectClass(env, o);
9837 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
9838 atomic_init(&calls->refcnt, 1);
9839 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9840 calls->o = (*env)->NewWeakGlobalRef(env, o);
9841 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
9842 CHECK(calls->process_pending_events_meth != NULL);
9844 LDKEventsProvider ret = {
9845 .this_arg = (void*) calls,
9846 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
9847 .free = LDKEventsProvider_JCalls_free,
9851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9852 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9853 *res_ptr = LDKEventsProvider_init(env, clz, o);
9854 return (uint64_t)res_ptr;
9856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
9857 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9858 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9859 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
9860 void* handler_ptr = (void*)(((uintptr_t)handler) & ~1);
9861 CHECK_ACCESS(handler_ptr);
9862 LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
9863 if (handler_conv.free == LDKEventHandler_JCalls_free) {
9864 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9865 LDKEventHandler_JCalls_cloned(&handler_conv);
9867 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
9870 typedef struct LDKListen_JCalls {
9871 atomic_size_t refcnt;
9874 jmethodID block_connected_meth;
9875 jmethodID block_disconnected_meth;
9877 static void LDKListen_JCalls_free(void* this_arg) {
9878 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9879 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9881 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9882 if (get_jenv_res == JNI_EDETACHED) {
9883 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9885 DO_ASSERT(get_jenv_res == JNI_OK);
9887 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9888 if (get_jenv_res == JNI_EDETACHED) {
9889 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9894 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
9895 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9897 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9898 if (get_jenv_res == JNI_EDETACHED) {
9899 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9901 DO_ASSERT(get_jenv_res == JNI_OK);
9903 LDKu8slice block_var = block;
9904 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
9905 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
9906 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9908 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
9909 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9910 (*env)->ExceptionDescribe(env);
9911 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
9913 if (get_jenv_res == JNI_EDETACHED) {
9914 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9917 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9918 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
9920 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9921 if (get_jenv_res == JNI_EDETACHED) {
9922 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9924 DO_ASSERT(get_jenv_res == JNI_OK);
9926 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
9927 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
9928 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9930 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
9931 if (UNLIKELY((*env)->ExceptionCheck(env))) {
9932 (*env)->ExceptionDescribe(env);
9933 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
9935 if (get_jenv_res == JNI_EDETACHED) {
9936 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9939 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
9940 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
9941 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9943 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
9944 jclass c = (*env)->GetObjectClass(env, o);
9946 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
9947 atomic_init(&calls->refcnt, 1);
9948 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9949 calls->o = (*env)->NewWeakGlobalRef(env, o);
9950 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
9951 CHECK(calls->block_connected_meth != NULL);
9952 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
9953 CHECK(calls->block_disconnected_meth != NULL);
9956 .this_arg = (void*) calls,
9957 .block_connected = block_connected_LDKListen_jcall,
9958 .block_disconnected = block_disconnected_LDKListen_jcall,
9959 .free = LDKListen_JCalls_free,
9963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
9964 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
9965 *res_ptr = LDKListen_init(env, clz, o);
9966 return (uint64_t)res_ptr;
9968 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) {
9969 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9970 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9971 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9972 LDKu8slice block_ref;
9973 block_ref.datalen = (*env)->GetArrayLength(env, block);
9974 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
9975 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
9976 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
9979 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) {
9980 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
9981 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
9982 LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9983 unsigned char header_arr[80];
9984 CHECK((*env)->GetArrayLength(env, header) == 80);
9985 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9986 unsigned char (*header_ref)[80] = &header_arr;
9987 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
9990 typedef struct LDKConfirm_JCalls {
9991 atomic_size_t refcnt;
9994 jmethodID transactions_confirmed_meth;
9995 jmethodID transaction_unconfirmed_meth;
9996 jmethodID best_block_updated_meth;
9997 jmethodID get_relevant_txids_meth;
9998 } LDKConfirm_JCalls;
9999 static void LDKConfirm_JCalls_free(void* this_arg) {
10000 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10001 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10003 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10004 if (get_jenv_res == JNI_EDETACHED) {
10005 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10007 DO_ASSERT(get_jenv_res == JNI_OK);
10009 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10010 if (get_jenv_res == JNI_EDETACHED) {
10011 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10016 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
10017 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10019 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10020 if (get_jenv_res == JNI_EDETACHED) {
10021 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10023 DO_ASSERT(get_jenv_res == JNI_OK);
10025 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10026 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10027 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
10028 int64_tArray txdata_arr = NULL;
10029 txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
10030 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
10031 for (size_t c = 0; c < txdata_var.datalen; c++) {
10032 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10033 *txdata_conv_28_conv = txdata_var.data[c];
10034 txdata_arr_ptr[c] = ((int64_t)txdata_conv_28_conv);
10036 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
10037 FREE(txdata_var.data);
10038 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10039 CHECK(obj != NULL);
10040 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
10041 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10042 (*env)->ExceptionDescribe(env);
10043 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
10045 if (get_jenv_res == JNI_EDETACHED) {
10046 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10049 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
10050 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10052 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10053 if (get_jenv_res == JNI_EDETACHED) {
10054 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10056 DO_ASSERT(get_jenv_res == JNI_OK);
10058 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
10059 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
10060 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10061 CHECK(obj != NULL);
10062 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
10063 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10064 (*env)->ExceptionDescribe(env);
10065 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
10067 if (get_jenv_res == JNI_EDETACHED) {
10068 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10071 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
10072 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10074 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10075 if (get_jenv_res == JNI_EDETACHED) {
10076 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10078 DO_ASSERT(get_jenv_res == JNI_OK);
10080 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
10081 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
10082 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10083 CHECK(obj != NULL);
10084 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
10085 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10086 (*env)->ExceptionDescribe(env);
10087 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
10089 if (get_jenv_res == JNI_EDETACHED) {
10090 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10093 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
10094 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
10096 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10097 if (get_jenv_res == JNI_EDETACHED) {
10098 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10100 DO_ASSERT(get_jenv_res == JNI_OK);
10102 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10103 CHECK(obj != NULL);
10104 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
10105 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10106 (*env)->ExceptionDescribe(env);
10107 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
10109 LDKCVec_TxidZ ret_constr;
10110 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
10111 if (ret_constr.datalen > 0)
10112 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10114 ret_constr.data = NULL;
10115 for (size_t i = 0; i < ret_constr.datalen; i++) {
10116 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
10117 LDKThirtyTwoBytes ret_conv_8_ref;
10118 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
10119 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
10120 ret_constr.data[i] = ret_conv_8_ref;
10122 if (get_jenv_res == JNI_EDETACHED) {
10123 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10127 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
10128 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
10129 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10131 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
10132 jclass c = (*env)->GetObjectClass(env, o);
10134 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
10135 atomic_init(&calls->refcnt, 1);
10136 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10137 calls->o = (*env)->NewWeakGlobalRef(env, o);
10138 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
10139 CHECK(calls->transactions_confirmed_meth != NULL);
10140 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
10141 CHECK(calls->transaction_unconfirmed_meth != NULL);
10142 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
10143 CHECK(calls->best_block_updated_meth != NULL);
10144 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
10145 CHECK(calls->get_relevant_txids_meth != NULL);
10148 .this_arg = (void*) calls,
10149 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
10150 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
10151 .best_block_updated = best_block_updated_LDKConfirm_jcall,
10152 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
10153 .free = LDKConfirm_JCalls_free,
10157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
10158 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
10159 *res_ptr = LDKConfirm_init(env, clz, o);
10160 return (uint64_t)res_ptr;
10162 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) {
10163 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10164 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10165 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10166 unsigned char header_arr[80];
10167 CHECK((*env)->GetArrayLength(env, header) == 80);
10168 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10169 unsigned char (*header_ref)[80] = &header_arr;
10170 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
10171 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
10172 if (txdata_constr.datalen > 0)
10173 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10175 txdata_constr.data = NULL;
10176 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
10177 for (size_t c = 0; c < txdata_constr.datalen; c++) {
10178 int64_t txdata_conv_28 = txdata_vals[c];
10179 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
10180 CHECK_ACCESS(txdata_conv_28_ptr);
10181 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
10182 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
10183 txdata_constr.data[c] = txdata_conv_28_conv;
10185 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
10186 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
10189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
10190 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10191 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10192 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10193 unsigned char txid_arr[32];
10194 CHECK((*env)->GetArrayLength(env, txid) == 32);
10195 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
10196 unsigned char (*txid_ref)[32] = &txid_arr;
10197 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
10200 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) {
10201 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10202 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10203 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10204 unsigned char header_arr[80];
10205 CHECK((*env)->GetArrayLength(env, header) == 80);
10206 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
10207 unsigned char (*header_ref)[80] = &header_arr;
10208 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
10211 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
10212 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10213 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10214 LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
10215 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
10216 jobjectArray ret_arr = NULL;
10217 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
10219 for (size_t i = 0; i < ret_var.datalen; i++) {
10220 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
10221 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
10222 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
10225 FREE(ret_var.data);
10229 typedef struct LDKPersist_JCalls {
10230 atomic_size_t refcnt;
10233 jmethodID persist_new_channel_meth;
10234 jmethodID update_persisted_channel_meth;
10235 } LDKPersist_JCalls;
10236 static void LDKPersist_JCalls_free(void* this_arg) {
10237 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10238 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10240 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10241 if (get_jenv_res == JNI_EDETACHED) {
10242 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10244 DO_ASSERT(get_jenv_res == JNI_OK);
10246 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10247 if (get_jenv_res == JNI_EDETACHED) {
10248 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10253 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10254 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10256 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10257 if (get_jenv_res == JNI_EDETACHED) {
10258 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10260 DO_ASSERT(get_jenv_res == JNI_OK);
10262 LDKOutPoint channel_id_var = channel_id;
10263 int64_t channel_id_ref = 0;
10264 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10265 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10266 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10267 channel_id_ref = (uintptr_t)channel_id_var.inner;
10268 if (channel_id_var.is_owned) {
10269 channel_id_ref |= 1;
10271 LDKChannelMonitor data_var = *data;
10272 int64_t data_ref = 0;
10273 data_var = ChannelMonitor_clone(&data_var);
10274 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10275 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10276 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10277 data_ref = (uintptr_t)data_var.inner;
10278 if (data_var.is_owned) {
10281 LDKMonitorUpdateId update_id_var = update_id;
10282 int64_t update_id_ref = 0;
10283 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10284 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10285 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10286 update_id_ref = (uintptr_t)update_id_var.inner;
10287 if (update_id_var.is_owned) {
10288 update_id_ref |= 1;
10290 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10291 CHECK(obj != NULL);
10292 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref);
10293 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10294 (*env)->ExceptionDescribe(env);
10295 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
10297 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10298 CHECK_ACCESS(ret_ptr);
10299 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10301 if (get_jenv_res == JNI_EDETACHED) {
10302 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10306 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
10307 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
10309 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10310 if (get_jenv_res == JNI_EDETACHED) {
10311 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10313 DO_ASSERT(get_jenv_res == JNI_OK);
10315 LDKOutPoint channel_id_var = channel_id;
10316 int64_t channel_id_ref = 0;
10317 CHECK((((uintptr_t)channel_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10318 CHECK((((uintptr_t)&channel_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10319 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
10320 channel_id_ref = (uintptr_t)channel_id_var.inner;
10321 if (channel_id_var.is_owned) {
10322 channel_id_ref |= 1;
10324 LDKChannelMonitorUpdate update_var = *update;
10325 int64_t update_ref = 0;
10326 if ((uintptr_t)update_var.inner > 4096) {
10327 update_var = ChannelMonitorUpdate_clone(&update_var);
10328 CHECK((((uintptr_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10329 CHECK((((uintptr_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10330 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
10331 update_ref = (uintptr_t)update_var.inner;
10332 if (update_var.is_owned) {
10336 LDKChannelMonitor data_var = *data;
10337 int64_t data_ref = 0;
10338 data_var = ChannelMonitor_clone(&data_var);
10339 CHECK((((uintptr_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10340 CHECK((((uintptr_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10341 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
10342 data_ref = (uintptr_t)data_var.inner;
10343 if (data_var.is_owned) {
10346 LDKMonitorUpdateId update_id_var = update_id;
10347 int64_t update_id_ref = 0;
10348 CHECK((((uintptr_t)update_id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10349 CHECK((((uintptr_t)&update_id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10350 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
10351 update_id_ref = (uintptr_t)update_id_var.inner;
10352 if (update_id_var.is_owned) {
10353 update_id_ref |= 1;
10355 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10356 CHECK(obj != NULL);
10357 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref);
10358 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10359 (*env)->ExceptionDescribe(env);
10360 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
10362 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
10363 CHECK_ACCESS(ret_ptr);
10364 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
10366 if (get_jenv_res == JNI_EDETACHED) {
10367 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10371 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
10372 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
10373 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10375 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
10376 jclass c = (*env)->GetObjectClass(env, o);
10378 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
10379 atomic_init(&calls->refcnt, 1);
10380 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10381 calls->o = (*env)->NewWeakGlobalRef(env, o);
10382 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)J");
10383 CHECK(calls->persist_new_channel_meth != NULL);
10384 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)J");
10385 CHECK(calls->update_persisted_channel_meth != NULL);
10388 .this_arg = (void*) calls,
10389 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
10390 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
10391 .free = LDKPersist_JCalls_free,
10395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
10396 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
10397 *res_ptr = LDKPersist_init(env, clz, o);
10398 return (uint64_t)res_ptr;
10400 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) {
10401 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10402 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10403 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10404 LDKOutPoint channel_id_conv;
10405 channel_id_conv.inner = (void*)(channel_id & (~1));
10406 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
10407 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10408 channel_id_conv = OutPoint_clone(&channel_id_conv);
10409 LDKChannelMonitor data_conv;
10410 data_conv.inner = (void*)(data & (~1));
10411 data_conv.is_owned = false;
10412 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10413 LDKMonitorUpdateId update_id_conv;
10414 update_id_conv.inner = (void*)(update_id & (~1));
10415 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
10416 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10417 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10418 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10419 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
10420 return (int64_t)ret_conv;
10423 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) {
10424 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
10425 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
10426 LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
10427 LDKOutPoint channel_id_conv;
10428 channel_id_conv.inner = (void*)(channel_id & (~1));
10429 channel_id_conv.is_owned = (channel_id & 1) || (channel_id == 0);
10430 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
10431 channel_id_conv = OutPoint_clone(&channel_id_conv);
10432 LDKChannelMonitorUpdate update_conv;
10433 update_conv.inner = (void*)(update & (~1));
10434 update_conv.is_owned = false;
10435 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
10436 LDKChannelMonitor data_conv;
10437 data_conv.inner = (void*)(data & (~1));
10438 data_conv.is_owned = false;
10439 CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
10440 LDKMonitorUpdateId update_id_conv;
10441 update_id_conv.inner = (void*)(update_id & (~1));
10442 update_id_conv.is_owned = (update_id & 1) || (update_id == 0);
10443 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
10444 update_id_conv = MonitorUpdateId_clone(&update_id_conv);
10445 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10446 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
10447 return (int64_t)ret_conv;
10450 typedef struct LDKChannelMessageHandler_JCalls {
10451 atomic_size_t refcnt;
10454 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
10455 jmethodID handle_open_channel_meth;
10456 jmethodID handle_accept_channel_meth;
10457 jmethodID handle_funding_created_meth;
10458 jmethodID handle_funding_signed_meth;
10459 jmethodID handle_funding_locked_meth;
10460 jmethodID handle_shutdown_meth;
10461 jmethodID handle_closing_signed_meth;
10462 jmethodID handle_update_add_htlc_meth;
10463 jmethodID handle_update_fulfill_htlc_meth;
10464 jmethodID handle_update_fail_htlc_meth;
10465 jmethodID handle_update_fail_malformed_htlc_meth;
10466 jmethodID handle_commitment_signed_meth;
10467 jmethodID handle_revoke_and_ack_meth;
10468 jmethodID handle_update_fee_meth;
10469 jmethodID handle_announcement_signatures_meth;
10470 jmethodID peer_disconnected_meth;
10471 jmethodID peer_connected_meth;
10472 jmethodID handle_channel_reestablish_meth;
10473 jmethodID handle_channel_update_meth;
10474 jmethodID handle_error_meth;
10475 } LDKChannelMessageHandler_JCalls;
10476 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
10477 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10478 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10480 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10481 if (get_jenv_res == JNI_EDETACHED) {
10482 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10484 DO_ASSERT(get_jenv_res == JNI_OK);
10486 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10487 if (get_jenv_res == JNI_EDETACHED) {
10488 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10493 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
10494 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10496 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10497 if (get_jenv_res == JNI_EDETACHED) {
10498 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10500 DO_ASSERT(get_jenv_res == JNI_OK);
10502 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10503 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10504 LDKInitFeatures their_features_var = their_features;
10505 int64_t their_features_ref = 0;
10506 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10507 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10508 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10509 their_features_ref = (uintptr_t)their_features_var.inner;
10510 if (their_features_var.is_owned) {
10511 their_features_ref |= 1;
10513 LDKOpenChannel msg_var = *msg;
10514 int64_t msg_ref = 0;
10515 msg_var = OpenChannel_clone(&msg_var);
10516 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10517 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10518 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10519 msg_ref = (uintptr_t)msg_var.inner;
10520 if (msg_var.is_owned) {
10523 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10524 CHECK(obj != NULL);
10525 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10526 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10527 (*env)->ExceptionDescribe(env);
10528 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
10530 if (get_jenv_res == JNI_EDETACHED) {
10531 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10534 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
10535 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10537 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10538 if (get_jenv_res == JNI_EDETACHED) {
10539 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10541 DO_ASSERT(get_jenv_res == JNI_OK);
10543 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10544 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10545 LDKInitFeatures their_features_var = their_features;
10546 int64_t their_features_ref = 0;
10547 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10548 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10549 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10550 their_features_ref = (uintptr_t)their_features_var.inner;
10551 if (their_features_var.is_owned) {
10552 their_features_ref |= 1;
10554 LDKAcceptChannel msg_var = *msg;
10555 int64_t msg_ref = 0;
10556 msg_var = AcceptChannel_clone(&msg_var);
10557 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10558 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10559 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10560 msg_ref = (uintptr_t)msg_var.inner;
10561 if (msg_var.is_owned) {
10564 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10565 CHECK(obj != NULL);
10566 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
10567 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10568 (*env)->ExceptionDescribe(env);
10569 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
10571 if (get_jenv_res == JNI_EDETACHED) {
10572 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10575 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
10576 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10578 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10579 if (get_jenv_res == JNI_EDETACHED) {
10580 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10582 DO_ASSERT(get_jenv_res == JNI_OK);
10584 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10585 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10586 LDKFundingCreated msg_var = *msg;
10587 int64_t msg_ref = 0;
10588 msg_var = FundingCreated_clone(&msg_var);
10589 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10590 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10591 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10592 msg_ref = (uintptr_t)msg_var.inner;
10593 if (msg_var.is_owned) {
10596 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10597 CHECK(obj != NULL);
10598 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
10599 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10600 (*env)->ExceptionDescribe(env);
10601 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
10603 if (get_jenv_res == JNI_EDETACHED) {
10604 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10607 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
10608 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10610 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10611 if (get_jenv_res == JNI_EDETACHED) {
10612 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10614 DO_ASSERT(get_jenv_res == JNI_OK);
10616 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10617 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10618 LDKFundingSigned msg_var = *msg;
10619 int64_t msg_ref = 0;
10620 msg_var = FundingSigned_clone(&msg_var);
10621 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10622 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10623 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10624 msg_ref = (uintptr_t)msg_var.inner;
10625 if (msg_var.is_owned) {
10628 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10629 CHECK(obj != NULL);
10630 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
10631 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10632 (*env)->ExceptionDescribe(env);
10633 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
10635 if (get_jenv_res == JNI_EDETACHED) {
10636 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10639 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
10640 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10642 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10643 if (get_jenv_res == JNI_EDETACHED) {
10644 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10646 DO_ASSERT(get_jenv_res == JNI_OK);
10648 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10649 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10650 LDKFundingLocked msg_var = *msg;
10651 int64_t msg_ref = 0;
10652 msg_var = FundingLocked_clone(&msg_var);
10653 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10654 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10655 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10656 msg_ref = (uintptr_t)msg_var.inner;
10657 if (msg_var.is_owned) {
10660 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10661 CHECK(obj != NULL);
10662 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
10663 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10664 (*env)->ExceptionDescribe(env);
10665 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
10667 if (get_jenv_res == JNI_EDETACHED) {
10668 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10671 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
10672 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10674 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10675 if (get_jenv_res == JNI_EDETACHED) {
10676 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10678 DO_ASSERT(get_jenv_res == JNI_OK);
10680 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10681 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10682 LDKInitFeatures their_features_var = *their_features;
10683 int64_t their_features_ref = 0;
10684 their_features_var = InitFeatures_clone(&their_features_var);
10685 CHECK((((uintptr_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10686 CHECK((((uintptr_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10687 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
10688 their_features_ref = (uintptr_t)their_features_var.inner;
10689 if (their_features_var.is_owned) {
10690 their_features_ref |= 1;
10692 LDKShutdown msg_var = *msg;
10693 int64_t msg_ref = 0;
10694 msg_var = Shutdown_clone(&msg_var);
10695 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10696 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10697 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10698 msg_ref = (uintptr_t)msg_var.inner;
10699 if (msg_var.is_owned) {
10702 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10703 CHECK(obj != NULL);
10704 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
10705 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10706 (*env)->ExceptionDescribe(env);
10707 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
10709 if (get_jenv_res == JNI_EDETACHED) {
10710 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10713 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
10714 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10716 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10717 if (get_jenv_res == JNI_EDETACHED) {
10718 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10720 DO_ASSERT(get_jenv_res == JNI_OK);
10722 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10723 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10724 LDKClosingSigned msg_var = *msg;
10725 int64_t msg_ref = 0;
10726 msg_var = ClosingSigned_clone(&msg_var);
10727 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10728 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10729 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10730 msg_ref = (uintptr_t)msg_var.inner;
10731 if (msg_var.is_owned) {
10734 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10735 CHECK(obj != NULL);
10736 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
10737 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10738 (*env)->ExceptionDescribe(env);
10739 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
10741 if (get_jenv_res == JNI_EDETACHED) {
10742 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10745 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
10746 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10748 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10749 if (get_jenv_res == JNI_EDETACHED) {
10750 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10752 DO_ASSERT(get_jenv_res == JNI_OK);
10754 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10755 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10756 LDKUpdateAddHTLC msg_var = *msg;
10757 int64_t msg_ref = 0;
10758 msg_var = UpdateAddHTLC_clone(&msg_var);
10759 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10760 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10761 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10762 msg_ref = (uintptr_t)msg_var.inner;
10763 if (msg_var.is_owned) {
10766 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10767 CHECK(obj != NULL);
10768 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
10769 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10770 (*env)->ExceptionDescribe(env);
10771 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
10773 if (get_jenv_res == JNI_EDETACHED) {
10774 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10777 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
10778 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10780 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10781 if (get_jenv_res == JNI_EDETACHED) {
10782 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10784 DO_ASSERT(get_jenv_res == JNI_OK);
10786 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10787 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10788 LDKUpdateFulfillHTLC msg_var = *msg;
10789 int64_t msg_ref = 0;
10790 msg_var = UpdateFulfillHTLC_clone(&msg_var);
10791 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10792 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10793 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10794 msg_ref = (uintptr_t)msg_var.inner;
10795 if (msg_var.is_owned) {
10798 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10799 CHECK(obj != NULL);
10800 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
10801 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10802 (*env)->ExceptionDescribe(env);
10803 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
10805 if (get_jenv_res == JNI_EDETACHED) {
10806 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10809 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
10810 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10812 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10813 if (get_jenv_res == JNI_EDETACHED) {
10814 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10816 DO_ASSERT(get_jenv_res == JNI_OK);
10818 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10819 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10820 LDKUpdateFailHTLC msg_var = *msg;
10821 int64_t msg_ref = 0;
10822 msg_var = UpdateFailHTLC_clone(&msg_var);
10823 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10824 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10825 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10826 msg_ref = (uintptr_t)msg_var.inner;
10827 if (msg_var.is_owned) {
10830 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10831 CHECK(obj != NULL);
10832 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
10833 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10834 (*env)->ExceptionDescribe(env);
10835 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
10837 if (get_jenv_res == JNI_EDETACHED) {
10838 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10841 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
10842 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10844 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10845 if (get_jenv_res == JNI_EDETACHED) {
10846 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10848 DO_ASSERT(get_jenv_res == JNI_OK);
10850 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10851 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10852 LDKUpdateFailMalformedHTLC msg_var = *msg;
10853 int64_t msg_ref = 0;
10854 msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
10855 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10856 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10857 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10858 msg_ref = (uintptr_t)msg_var.inner;
10859 if (msg_var.is_owned) {
10862 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10863 CHECK(obj != NULL);
10864 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
10865 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10866 (*env)->ExceptionDescribe(env);
10867 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
10869 if (get_jenv_res == JNI_EDETACHED) {
10870 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10873 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
10874 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10876 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10877 if (get_jenv_res == JNI_EDETACHED) {
10878 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10880 DO_ASSERT(get_jenv_res == JNI_OK);
10882 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10883 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10884 LDKCommitmentSigned msg_var = *msg;
10885 int64_t msg_ref = 0;
10886 msg_var = CommitmentSigned_clone(&msg_var);
10887 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10888 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10889 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10890 msg_ref = (uintptr_t)msg_var.inner;
10891 if (msg_var.is_owned) {
10894 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10895 CHECK(obj != NULL);
10896 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
10897 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10898 (*env)->ExceptionDescribe(env);
10899 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
10901 if (get_jenv_res == JNI_EDETACHED) {
10902 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10905 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
10906 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10908 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10909 if (get_jenv_res == JNI_EDETACHED) {
10910 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10912 DO_ASSERT(get_jenv_res == JNI_OK);
10914 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10915 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10916 LDKRevokeAndACK msg_var = *msg;
10917 int64_t msg_ref = 0;
10918 msg_var = RevokeAndACK_clone(&msg_var);
10919 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10920 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10921 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10922 msg_ref = (uintptr_t)msg_var.inner;
10923 if (msg_var.is_owned) {
10926 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10927 CHECK(obj != NULL);
10928 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
10929 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10930 (*env)->ExceptionDescribe(env);
10931 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
10933 if (get_jenv_res == JNI_EDETACHED) {
10934 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10937 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
10938 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10940 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10941 if (get_jenv_res == JNI_EDETACHED) {
10942 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10944 DO_ASSERT(get_jenv_res == JNI_OK);
10946 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10947 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10948 LDKUpdateFee msg_var = *msg;
10949 int64_t msg_ref = 0;
10950 msg_var = UpdateFee_clone(&msg_var);
10951 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10952 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10953 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10954 msg_ref = (uintptr_t)msg_var.inner;
10955 if (msg_var.is_owned) {
10958 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10959 CHECK(obj != NULL);
10960 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
10961 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10962 (*env)->ExceptionDescribe(env);
10963 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
10965 if (get_jenv_res == JNI_EDETACHED) {
10966 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10969 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
10970 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
10972 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10973 if (get_jenv_res == JNI_EDETACHED) {
10974 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10976 DO_ASSERT(get_jenv_res == JNI_OK);
10978 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
10979 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
10980 LDKAnnouncementSignatures msg_var = *msg;
10981 int64_t msg_ref = 0;
10982 msg_var = AnnouncementSignatures_clone(&msg_var);
10983 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10984 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10985 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10986 msg_ref = (uintptr_t)msg_var.inner;
10987 if (msg_var.is_owned) {
10990 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10991 CHECK(obj != NULL);
10992 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
10993 if (UNLIKELY((*env)->ExceptionCheck(env))) {
10994 (*env)->ExceptionDescribe(env);
10995 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
10997 if (get_jenv_res == JNI_EDETACHED) {
10998 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11001 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
11002 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11004 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11005 if (get_jenv_res == JNI_EDETACHED) {
11006 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11008 DO_ASSERT(get_jenv_res == JNI_OK);
11010 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11011 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11012 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11013 CHECK(obj != NULL);
11014 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
11015 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11016 (*env)->ExceptionDescribe(env);
11017 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
11019 if (get_jenv_res == JNI_EDETACHED) {
11020 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11023 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
11024 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11026 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11027 if (get_jenv_res == JNI_EDETACHED) {
11028 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11030 DO_ASSERT(get_jenv_res == JNI_OK);
11032 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11033 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11034 LDKInit msg_var = *msg;
11035 int64_t msg_ref = 0;
11036 msg_var = Init_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->peer_connected_meth, their_node_id_arr, msg_ref);
11047 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11048 (*env)->ExceptionDescribe(env);
11049 (*env)->FatalError(env, "A call to peer_connected 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_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * 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 LDKChannelReestablish msg_var = *msg;
11067 int64_t msg_ref = 0;
11068 msg_var = ChannelReestablish_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_channel_reestablish_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_channel_reestablish 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_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * 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 LDKChannelUpdate msg_var = *msg;
11099 int64_t msg_ref = 0;
11100 msg_var = ChannelUpdate_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_channel_update_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_channel_update 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_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * 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 LDKErrorMessage msg_var = *msg;
11131 int64_t msg_ref = 0;
11132 msg_var = ErrorMessage_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_error_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_error 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 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
11152 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
11153 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11154 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11156 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11157 jclass c = (*env)->GetObjectClass(env, o);
11159 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
11160 atomic_init(&calls->refcnt, 1);
11161 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11162 calls->o = (*env)->NewWeakGlobalRef(env, o);
11163 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
11164 CHECK(calls->handle_open_channel_meth != NULL);
11165 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
11166 CHECK(calls->handle_accept_channel_meth != NULL);
11167 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
11168 CHECK(calls->handle_funding_created_meth != NULL);
11169 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
11170 CHECK(calls->handle_funding_signed_meth != NULL);
11171 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
11172 CHECK(calls->handle_funding_locked_meth != NULL);
11173 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
11174 CHECK(calls->handle_shutdown_meth != NULL);
11175 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
11176 CHECK(calls->handle_closing_signed_meth != NULL);
11177 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
11178 CHECK(calls->handle_update_add_htlc_meth != NULL);
11179 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
11180 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
11181 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
11182 CHECK(calls->handle_update_fail_htlc_meth != NULL);
11183 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
11184 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
11185 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
11186 CHECK(calls->handle_commitment_signed_meth != NULL);
11187 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
11188 CHECK(calls->handle_revoke_and_ack_meth != NULL);
11189 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
11190 CHECK(calls->handle_update_fee_meth != NULL);
11191 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
11192 CHECK(calls->handle_announcement_signatures_meth != NULL);
11193 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
11194 CHECK(calls->peer_disconnected_meth != NULL);
11195 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
11196 CHECK(calls->peer_connected_meth != NULL);
11197 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
11198 CHECK(calls->handle_channel_reestablish_meth != NULL);
11199 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
11200 CHECK(calls->handle_channel_update_meth != NULL);
11201 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
11202 CHECK(calls->handle_error_meth != NULL);
11204 LDKChannelMessageHandler ret = {
11205 .this_arg = (void*) calls,
11206 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
11207 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
11208 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
11209 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
11210 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
11211 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
11212 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
11213 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
11214 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
11215 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
11216 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
11217 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
11218 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
11219 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
11220 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
11221 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
11222 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
11223 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
11224 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
11225 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
11226 .free = LDKChannelMessageHandler_JCalls_free,
11227 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
11229 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
11232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11233 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
11234 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
11235 return (uint64_t)res_ptr;
11237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
11238 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
11239 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
11240 DO_ASSERT((res_ptr & 1) == 0);
11241 return (int64_t)(res_ptr | 1);
11243 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) {
11244 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11245 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11246 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11247 LDKPublicKey their_node_id_ref;
11248 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11249 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11250 LDKInitFeatures their_features_conv;
11251 their_features_conv.inner = (void*)(their_features & (~1));
11252 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
11253 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11254 their_features_conv = InitFeatures_clone(&their_features_conv);
11255 LDKOpenChannel msg_conv;
11256 msg_conv.inner = (void*)(msg & (~1));
11257 msg_conv.is_owned = false;
11258 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11259 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11262 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) {
11263 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11264 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11265 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11266 LDKPublicKey their_node_id_ref;
11267 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11268 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11269 LDKInitFeatures their_features_conv;
11270 their_features_conv.inner = (void*)(their_features & (~1));
11271 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
11272 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11273 their_features_conv = InitFeatures_clone(&their_features_conv);
11274 LDKAcceptChannel msg_conv;
11275 msg_conv.inner = (void*)(msg & (~1));
11276 msg_conv.is_owned = false;
11277 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11278 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
11281 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) {
11282 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11283 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11284 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11285 LDKPublicKey their_node_id_ref;
11286 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11287 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11288 LDKFundingCreated msg_conv;
11289 msg_conv.inner = (void*)(msg & (~1));
11290 msg_conv.is_owned = false;
11291 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11292 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11295 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) {
11296 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11297 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11298 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11299 LDKPublicKey their_node_id_ref;
11300 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11301 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11302 LDKFundingSigned msg_conv;
11303 msg_conv.inner = (void*)(msg & (~1));
11304 msg_conv.is_owned = false;
11305 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11306 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11309 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) {
11310 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11311 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11312 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11313 LDKPublicKey their_node_id_ref;
11314 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11315 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11316 LDKFundingLocked msg_conv;
11317 msg_conv.inner = (void*)(msg & (~1));
11318 msg_conv.is_owned = false;
11319 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11320 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11323 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) {
11324 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11325 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11326 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11327 LDKPublicKey their_node_id_ref;
11328 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11329 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11330 LDKInitFeatures their_features_conv;
11331 their_features_conv.inner = (void*)(their_features & (~1));
11332 their_features_conv.is_owned = false;
11333 CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
11334 LDKShutdown msg_conv;
11335 msg_conv.inner = (void*)(msg & (~1));
11336 msg_conv.is_owned = false;
11337 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11338 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
11341 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) {
11342 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11343 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11344 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11345 LDKPublicKey their_node_id_ref;
11346 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11347 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11348 LDKClosingSigned msg_conv;
11349 msg_conv.inner = (void*)(msg & (~1));
11350 msg_conv.is_owned = false;
11351 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11352 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11355 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) {
11356 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11357 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11358 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11359 LDKPublicKey their_node_id_ref;
11360 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11361 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11362 LDKUpdateAddHTLC msg_conv;
11363 msg_conv.inner = (void*)(msg & (~1));
11364 msg_conv.is_owned = false;
11365 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11366 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11369 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) {
11370 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11371 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11372 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11373 LDKPublicKey their_node_id_ref;
11374 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11375 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11376 LDKUpdateFulfillHTLC msg_conv;
11377 msg_conv.inner = (void*)(msg & (~1));
11378 msg_conv.is_owned = false;
11379 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11380 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11383 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) {
11384 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11385 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11386 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11387 LDKPublicKey their_node_id_ref;
11388 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11389 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11390 LDKUpdateFailHTLC msg_conv;
11391 msg_conv.inner = (void*)(msg & (~1));
11392 msg_conv.is_owned = false;
11393 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11394 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11397 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) {
11398 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11399 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11400 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11401 LDKPublicKey their_node_id_ref;
11402 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11403 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11404 LDKUpdateFailMalformedHTLC msg_conv;
11405 msg_conv.inner = (void*)(msg & (~1));
11406 msg_conv.is_owned = false;
11407 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11408 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11411 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) {
11412 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11413 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11414 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11415 LDKPublicKey their_node_id_ref;
11416 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11417 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11418 LDKCommitmentSigned msg_conv;
11419 msg_conv.inner = (void*)(msg & (~1));
11420 msg_conv.is_owned = false;
11421 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11422 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11425 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) {
11426 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11427 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11428 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11429 LDKPublicKey their_node_id_ref;
11430 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11431 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11432 LDKRevokeAndACK msg_conv;
11433 msg_conv.inner = (void*)(msg & (~1));
11434 msg_conv.is_owned = false;
11435 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11436 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11439 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) {
11440 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11441 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11442 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11443 LDKPublicKey their_node_id_ref;
11444 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11445 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11446 LDKUpdateFee msg_conv;
11447 msg_conv.inner = (void*)(msg & (~1));
11448 msg_conv.is_owned = false;
11449 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11450 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11453 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) {
11454 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11455 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11456 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11457 LDKPublicKey their_node_id_ref;
11458 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11459 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11460 LDKAnnouncementSignatures msg_conv;
11461 msg_conv.inner = (void*)(msg & (~1));
11462 msg_conv.is_owned = false;
11463 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11464 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11467 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) {
11468 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11469 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11470 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11471 LDKPublicKey their_node_id_ref;
11472 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11473 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11474 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
11477 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) {
11478 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11479 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11480 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11481 LDKPublicKey their_node_id_ref;
11482 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11483 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11485 msg_conv.inner = (void*)(msg & (~1));
11486 msg_conv.is_owned = false;
11487 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11488 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11491 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) {
11492 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11493 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11494 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11495 LDKPublicKey their_node_id_ref;
11496 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11497 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11498 LDKChannelReestablish msg_conv;
11499 msg_conv.inner = (void*)(msg & (~1));
11500 msg_conv.is_owned = false;
11501 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11502 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11505 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) {
11506 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11507 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11508 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11509 LDKPublicKey their_node_id_ref;
11510 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11511 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11512 LDKChannelUpdate msg_conv;
11513 msg_conv.inner = (void*)(msg & (~1));
11514 msg_conv.is_owned = false;
11515 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11516 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11519 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) {
11520 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11521 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11522 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
11523 LDKPublicKey their_node_id_ref;
11524 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
11525 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11526 LDKErrorMessage msg_conv;
11527 msg_conv.inner = (void*)(msg & (~1));
11528 msg_conv.is_owned = false;
11529 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11530 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
11533 typedef struct LDKRoutingMessageHandler_JCalls {
11534 atomic_size_t refcnt;
11537 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11538 jmethodID handle_node_announcement_meth;
11539 jmethodID handle_channel_announcement_meth;
11540 jmethodID handle_channel_update_meth;
11541 jmethodID get_next_channel_announcements_meth;
11542 jmethodID get_next_node_announcements_meth;
11543 jmethodID sync_routing_table_meth;
11544 jmethodID handle_reply_channel_range_meth;
11545 jmethodID handle_reply_short_channel_ids_end_meth;
11546 jmethodID handle_query_channel_range_meth;
11547 jmethodID handle_query_short_channel_ids_meth;
11548 } LDKRoutingMessageHandler_JCalls;
11549 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
11550 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11551 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11553 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11554 if (get_jenv_res == JNI_EDETACHED) {
11555 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11557 DO_ASSERT(get_jenv_res == JNI_OK);
11559 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11560 if (get_jenv_res == JNI_EDETACHED) {
11561 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11566 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
11567 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11569 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11570 if (get_jenv_res == JNI_EDETACHED) {
11571 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11573 DO_ASSERT(get_jenv_res == JNI_OK);
11575 LDKNodeAnnouncement msg_var = *msg;
11576 int64_t msg_ref = 0;
11577 msg_var = NodeAnnouncement_clone(&msg_var);
11578 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11579 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11580 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11581 msg_ref = (uintptr_t)msg_var.inner;
11582 if (msg_var.is_owned) {
11585 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11586 CHECK(obj != NULL);
11587 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
11588 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11589 (*env)->ExceptionDescribe(env);
11590 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11592 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11593 CHECK_ACCESS(ret_ptr);
11594 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11596 if (get_jenv_res == JNI_EDETACHED) {
11597 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11601 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
11602 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11604 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11605 if (get_jenv_res == JNI_EDETACHED) {
11606 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11608 DO_ASSERT(get_jenv_res == JNI_OK);
11610 LDKChannelAnnouncement msg_var = *msg;
11611 int64_t msg_ref = 0;
11612 msg_var = ChannelAnnouncement_clone(&msg_var);
11613 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11614 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11615 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11616 msg_ref = (uintptr_t)msg_var.inner;
11617 if (msg_var.is_owned) {
11620 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11621 CHECK(obj != NULL);
11622 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
11623 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11624 (*env)->ExceptionDescribe(env);
11625 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
11627 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11628 CHECK_ACCESS(ret_ptr);
11629 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11631 if (get_jenv_res == JNI_EDETACHED) {
11632 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11636 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
11637 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11639 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11640 if (get_jenv_res == JNI_EDETACHED) {
11641 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11643 DO_ASSERT(get_jenv_res == JNI_OK);
11645 LDKChannelUpdate msg_var = *msg;
11646 int64_t msg_ref = 0;
11647 msg_var = ChannelUpdate_clone(&msg_var);
11648 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11649 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11650 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11651 msg_ref = (uintptr_t)msg_var.inner;
11652 if (msg_var.is_owned) {
11655 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11656 CHECK(obj != NULL);
11657 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
11658 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11659 (*env)->ExceptionDescribe(env);
11660 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
11662 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11663 CHECK_ACCESS(ret_ptr);
11664 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
11666 if (get_jenv_res == JNI_EDETACHED) {
11667 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11671 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
11672 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11674 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11675 if (get_jenv_res == JNI_EDETACHED) {
11676 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11678 DO_ASSERT(get_jenv_res == JNI_OK);
11680 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11681 CHECK(obj != NULL);
11682 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
11683 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11684 (*env)->ExceptionDescribe(env);
11685 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
11687 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
11688 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11689 if (ret_constr.datalen > 0)
11690 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11692 ret_constr.data = NULL;
11693 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11694 for (size_t h = 0; h < ret_constr.datalen; h++) {
11695 int64_t ret_conv_59 = ret_vals[h];
11696 void* ret_conv_59_ptr = (void*)(((uintptr_t)ret_conv_59) & ~1);
11697 CHECK_ACCESS(ret_conv_59_ptr);
11698 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ret_conv_59_ptr);
11699 FREE((void*)ret_conv_59);
11700 ret_constr.data[h] = ret_conv_59_conv;
11702 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11703 if (get_jenv_res == JNI_EDETACHED) {
11704 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11708 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
11709 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11711 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11712 if (get_jenv_res == JNI_EDETACHED) {
11713 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11715 DO_ASSERT(get_jenv_res == JNI_OK);
11717 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
11718 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
11719 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11720 CHECK(obj != NULL);
11721 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
11722 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11723 (*env)->ExceptionDescribe(env);
11724 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
11726 LDKCVec_NodeAnnouncementZ ret_constr;
11727 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
11728 if (ret_constr.datalen > 0)
11729 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11731 ret_constr.data = NULL;
11732 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
11733 for (size_t s = 0; s < ret_constr.datalen; s++) {
11734 int64_t ret_conv_18 = ret_vals[s];
11735 LDKNodeAnnouncement ret_conv_18_conv;
11736 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
11737 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
11738 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_conv);
11739 ret_constr.data[s] = ret_conv_18_conv;
11741 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
11742 if (get_jenv_res == JNI_EDETACHED) {
11743 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11747 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
11748 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11750 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11751 if (get_jenv_res == JNI_EDETACHED) {
11752 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11754 DO_ASSERT(get_jenv_res == JNI_OK);
11756 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11757 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11758 LDKInit init_var = *init;
11759 int64_t init_ref = 0;
11760 init_var = Init_clone(&init_var);
11761 CHECK((((uintptr_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11762 CHECK((((uintptr_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11763 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
11764 init_ref = (uintptr_t)init_var.inner;
11765 if (init_var.is_owned) {
11768 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11769 CHECK(obj != NULL);
11770 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
11771 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11772 (*env)->ExceptionDescribe(env);
11773 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
11775 if (get_jenv_res == JNI_EDETACHED) {
11776 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11779 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
11780 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11782 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11783 if (get_jenv_res == JNI_EDETACHED) {
11784 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11786 DO_ASSERT(get_jenv_res == JNI_OK);
11788 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11789 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11790 LDKReplyChannelRange msg_var = msg;
11791 int64_t msg_ref = 0;
11792 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11793 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11794 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11795 msg_ref = (uintptr_t)msg_var.inner;
11796 if (msg_var.is_owned) {
11799 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11800 CHECK(obj != NULL);
11801 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
11802 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11803 (*env)->ExceptionDescribe(env);
11804 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
11806 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11807 CHECK_ACCESS(ret_ptr);
11808 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11810 if (get_jenv_res == JNI_EDETACHED) {
11811 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11815 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
11816 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11818 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11819 if (get_jenv_res == JNI_EDETACHED) {
11820 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11822 DO_ASSERT(get_jenv_res == JNI_OK);
11824 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11825 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11826 LDKReplyShortChannelIdsEnd msg_var = msg;
11827 int64_t msg_ref = 0;
11828 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11829 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11830 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11831 msg_ref = (uintptr_t)msg_var.inner;
11832 if (msg_var.is_owned) {
11835 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11836 CHECK(obj != NULL);
11837 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
11838 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11839 (*env)->ExceptionDescribe(env);
11840 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
11842 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11843 CHECK_ACCESS(ret_ptr);
11844 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11846 if (get_jenv_res == JNI_EDETACHED) {
11847 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11851 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
11852 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11854 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11855 if (get_jenv_res == JNI_EDETACHED) {
11856 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11858 DO_ASSERT(get_jenv_res == JNI_OK);
11860 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11861 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11862 LDKQueryChannelRange msg_var = msg;
11863 int64_t msg_ref = 0;
11864 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11865 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11866 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11867 msg_ref = (uintptr_t)msg_var.inner;
11868 if (msg_var.is_owned) {
11871 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11872 CHECK(obj != NULL);
11873 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
11874 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11875 (*env)->ExceptionDescribe(env);
11876 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
11878 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11879 CHECK_ACCESS(ret_ptr);
11880 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11882 if (get_jenv_res == JNI_EDETACHED) {
11883 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11887 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
11888 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
11890 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11891 if (get_jenv_res == JNI_EDETACHED) {
11892 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11894 DO_ASSERT(get_jenv_res == JNI_OK);
11896 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
11897 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
11898 LDKQueryShortChannelIds msg_var = msg;
11899 int64_t msg_ref = 0;
11900 CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11901 CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11902 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11903 msg_ref = (uintptr_t)msg_var.inner;
11904 if (msg_var.is_owned) {
11907 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11908 CHECK(obj != NULL);
11909 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
11910 if (UNLIKELY((*env)->ExceptionCheck(env))) {
11911 (*env)->ExceptionDescribe(env);
11912 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
11914 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
11915 CHECK_ACCESS(ret_ptr);
11916 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
11918 if (get_jenv_res == JNI_EDETACHED) {
11919 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11923 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
11924 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
11925 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11926 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11928 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11929 jclass c = (*env)->GetObjectClass(env, o);
11931 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
11932 atomic_init(&calls->refcnt, 1);
11933 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11934 calls->o = (*env)->NewWeakGlobalRef(env, o);
11935 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
11936 CHECK(calls->handle_node_announcement_meth != NULL);
11937 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
11938 CHECK(calls->handle_channel_announcement_meth != NULL);
11939 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
11940 CHECK(calls->handle_channel_update_meth != NULL);
11941 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
11942 CHECK(calls->get_next_channel_announcements_meth != NULL);
11943 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
11944 CHECK(calls->get_next_node_announcements_meth != NULL);
11945 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
11946 CHECK(calls->sync_routing_table_meth != NULL);
11947 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
11948 CHECK(calls->handle_reply_channel_range_meth != NULL);
11949 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
11950 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
11951 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
11952 CHECK(calls->handle_query_channel_range_meth != NULL);
11953 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
11954 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
11956 LDKRoutingMessageHandler ret = {
11957 .this_arg = (void*) calls,
11958 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
11959 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
11960 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
11961 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
11962 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
11963 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
11964 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
11965 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
11966 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
11967 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
11968 .free = LDKRoutingMessageHandler_JCalls_free,
11969 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
11971 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
11974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
11975 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
11976 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
11977 return (uint64_t)res_ptr;
11979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
11980 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
11981 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
11982 DO_ASSERT((res_ptr & 1) == 0);
11983 return (int64_t)(res_ptr | 1);
11985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
11986 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
11987 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
11988 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
11989 LDKNodeAnnouncement msg_conv;
11990 msg_conv.inner = (void*)(msg & (~1));
11991 msg_conv.is_owned = false;
11992 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
11993 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11994 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
11995 return (int64_t)ret_conv;
11998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
11999 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12000 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12001 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12002 LDKChannelAnnouncement msg_conv;
12003 msg_conv.inner = (void*)(msg & (~1));
12004 msg_conv.is_owned = false;
12005 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12006 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12007 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
12008 return (int64_t)ret_conv;
12011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
12012 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12013 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12014 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12015 LDKChannelUpdate msg_conv;
12016 msg_conv.inner = (void*)(msg & (~1));
12017 msg_conv.is_owned = false;
12018 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12019 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12020 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
12021 return (int64_t)ret_conv;
12024 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) {
12025 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12026 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12027 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12028 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
12029 int64_tArray ret_arr = NULL;
12030 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12031 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12032 for (size_t h = 0; h < ret_var.datalen; h++) {
12033 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_59_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
12034 *ret_conv_59_conv = ret_var.data[h];
12035 ret_arr_ptr[h] = ((int64_t)ret_conv_59_conv);
12037 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12038 FREE(ret_var.data);
12042 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) {
12043 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12044 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12045 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12046 LDKPublicKey starting_point_ref;
12047 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
12048 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
12049 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
12050 int64_tArray ret_arr = NULL;
12051 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12052 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12053 for (size_t s = 0; s < ret_var.datalen; s++) {
12054 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
12055 int64_t ret_conv_18_ref = 0;
12056 CHECK((((uintptr_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12057 CHECK((((uintptr_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12058 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_18_var);
12059 ret_conv_18_ref = (uintptr_t)ret_conv_18_var.inner;
12060 if (ret_conv_18_var.is_owned) {
12061 ret_conv_18_ref |= 1;
12063 ret_arr_ptr[s] = ret_conv_18_ref;
12065 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12066 FREE(ret_var.data);
12070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
12071 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12072 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12073 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12074 LDKPublicKey their_node_id_ref;
12075 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12076 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12078 init_conv.inner = (void*)(init & (~1));
12079 init_conv.is_owned = false;
12080 CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
12081 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
12084 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) {
12085 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12086 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12087 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12088 LDKPublicKey their_node_id_ref;
12089 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12090 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12091 LDKReplyChannelRange msg_conv;
12092 msg_conv.inner = (void*)(msg & (~1));
12093 msg_conv.is_owned = (msg & 1) || (msg == 0);
12094 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12095 msg_conv = ReplyChannelRange_clone(&msg_conv);
12096 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12097 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12098 return (int64_t)ret_conv;
12101 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) {
12102 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12103 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12104 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12105 LDKPublicKey their_node_id_ref;
12106 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12107 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12108 LDKReplyShortChannelIdsEnd msg_conv;
12109 msg_conv.inner = (void*)(msg & (~1));
12110 msg_conv.is_owned = (msg & 1) || (msg == 0);
12111 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12112 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
12113 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12114 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12115 return (int64_t)ret_conv;
12118 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) {
12119 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12120 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12121 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12122 LDKPublicKey their_node_id_ref;
12123 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12124 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12125 LDKQueryChannelRange msg_conv;
12126 msg_conv.inner = (void*)(msg & (~1));
12127 msg_conv.is_owned = (msg & 1) || (msg == 0);
12128 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12129 msg_conv = QueryChannelRange_clone(&msg_conv);
12130 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12131 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12132 return (int64_t)ret_conv;
12135 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) {
12136 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12137 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12138 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12139 LDKPublicKey their_node_id_ref;
12140 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
12141 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12142 LDKQueryShortChannelIds msg_conv;
12143 msg_conv.inner = (void*)(msg & (~1));
12144 msg_conv.is_owned = (msg & 1) || (msg == 0);
12145 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12146 msg_conv = QueryShortChannelIds_clone(&msg_conv);
12147 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12148 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12149 return (int64_t)ret_conv;
12152 typedef struct LDKCustomMessageReader_JCalls {
12153 atomic_size_t refcnt;
12156 jmethodID read_meth;
12157 } LDKCustomMessageReader_JCalls;
12158 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
12159 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12160 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12162 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12163 if (get_jenv_res == JNI_EDETACHED) {
12164 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12166 DO_ASSERT(get_jenv_res == JNI_OK);
12168 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12169 if (get_jenv_res == JNI_EDETACHED) {
12170 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12175 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
12176 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
12178 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12179 if (get_jenv_res == JNI_EDETACHED) {
12180 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12182 DO_ASSERT(get_jenv_res == JNI_OK);
12184 LDKu8slice buffer_var = buffer;
12185 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
12186 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
12187 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12188 CHECK(obj != NULL);
12189 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
12190 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12191 (*env)->ExceptionDescribe(env);
12192 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
12194 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12195 CHECK_ACCESS(ret_ptr);
12196 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
12198 if (get_jenv_res == JNI_EDETACHED) {
12199 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12203 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
12204 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
12205 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12207 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
12208 jclass c = (*env)->GetObjectClass(env, o);
12210 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
12211 atomic_init(&calls->refcnt, 1);
12212 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12213 calls->o = (*env)->NewWeakGlobalRef(env, o);
12214 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
12215 CHECK(calls->read_meth != NULL);
12217 LDKCustomMessageReader ret = {
12218 .this_arg = (void*) calls,
12219 .read = read_LDKCustomMessageReader_jcall,
12220 .free = LDKCustomMessageReader_JCalls_free,
12224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
12225 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
12226 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
12227 return (uint64_t)res_ptr;
12229 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) {
12230 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12231 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12232 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
12233 LDKu8slice buffer_ref;
12234 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
12235 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
12236 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12237 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
12238 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
12239 return (int64_t)ret_conv;
12242 typedef struct LDKCustomMessageHandler_JCalls {
12243 atomic_size_t refcnt;
12246 LDKCustomMessageReader_JCalls* CustomMessageReader;
12247 jmethodID handle_custom_message_meth;
12248 jmethodID get_and_clear_pending_msg_meth;
12249 } LDKCustomMessageHandler_JCalls;
12250 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
12251 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12252 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12254 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12255 if (get_jenv_res == JNI_EDETACHED) {
12256 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12258 DO_ASSERT(get_jenv_res == JNI_OK);
12260 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12261 if (get_jenv_res == JNI_EDETACHED) {
12262 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12267 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
12268 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12270 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12271 if (get_jenv_res == JNI_EDETACHED) {
12272 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12274 DO_ASSERT(get_jenv_res == JNI_OK);
12276 LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
12278 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
12279 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
12280 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12281 CHECK(obj != NULL);
12282 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (int64_t)msg_ret, sender_node_id_arr);
12283 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12284 (*env)->ExceptionDescribe(env);
12285 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
12287 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12288 CHECK_ACCESS(ret_ptr);
12289 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12291 if (get_jenv_res == JNI_EDETACHED) {
12292 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12296 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
12297 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
12299 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12300 if (get_jenv_res == JNI_EDETACHED) {
12301 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12303 DO_ASSERT(get_jenv_res == JNI_OK);
12305 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12306 CHECK(obj != NULL);
12307 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
12308 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12309 (*env)->ExceptionDescribe(env);
12310 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
12312 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
12313 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
12314 if (ret_constr.datalen > 0)
12315 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
12317 ret_constr.data = NULL;
12318 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
12319 for (size_t z = 0; z < ret_constr.datalen; z++) {
12320 int64_t ret_conv_25 = ret_vals[z];
12321 void* ret_conv_25_ptr = (void*)(((uintptr_t)ret_conv_25) & ~1);
12322 CHECK_ACCESS(ret_conv_25_ptr);
12323 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
12324 FREE((void*)ret_conv_25);
12325 ret_constr.data[z] = ret_conv_25_conv;
12327 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
12328 if (get_jenv_res == JNI_EDETACHED) {
12329 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12333 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
12334 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
12335 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12336 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
12338 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12339 jclass c = (*env)->GetObjectClass(env, o);
12341 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
12342 atomic_init(&calls->refcnt, 1);
12343 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12344 calls->o = (*env)->NewWeakGlobalRef(env, o);
12345 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
12346 CHECK(calls->handle_custom_message_meth != NULL);
12347 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
12348 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
12350 LDKCustomMessageHandler ret = {
12351 .this_arg = (void*) calls,
12352 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
12353 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
12354 .free = LDKCustomMessageHandler_JCalls_free,
12355 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
12357 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
12360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
12361 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
12362 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
12363 return (uint64_t)res_ptr;
12365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
12366 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
12367 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
12368 DO_ASSERT((res_ptr & 1) == 0);
12369 return (int64_t)(res_ptr | 1);
12371 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) {
12372 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12373 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12374 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12375 void* msg_ptr = (void*)(((uintptr_t)msg) & ~1);
12376 CHECK_ACCESS(msg_ptr);
12377 LDKType msg_conv = *(LDKType*)(msg_ptr);
12378 if (msg_conv.free == LDKType_JCalls_free) {
12379 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12380 LDKType_JCalls_cloned(&msg_conv);
12382 LDKPublicKey sender_node_id_ref;
12383 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
12384 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
12385 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12386 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
12387 return (int64_t)ret_conv;
12390 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
12391 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12392 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12393 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
12394 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
12395 int64_tArray ret_arr = NULL;
12396 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12397 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12398 for (size_t z = 0; z < ret_var.datalen; z++) {
12399 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12400 *ret_conv_25_conv = ret_var.data[z];
12401 ret_arr_ptr[z] = ((int64_t)ret_conv_25_conv);
12403 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12404 FREE(ret_var.data);
12408 typedef struct LDKSocketDescriptor_JCalls {
12409 atomic_size_t refcnt;
12412 jmethodID send_data_meth;
12413 jmethodID disconnect_socket_meth;
12415 jmethodID hash_meth;
12416 } LDKSocketDescriptor_JCalls;
12417 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
12418 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12419 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12421 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12422 if (get_jenv_res == JNI_EDETACHED) {
12423 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12425 DO_ASSERT(get_jenv_res == JNI_OK);
12427 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12428 if (get_jenv_res == JNI_EDETACHED) {
12429 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12434 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
12435 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12437 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12438 if (get_jenv_res == JNI_EDETACHED) {
12439 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12441 DO_ASSERT(get_jenv_res == JNI_OK);
12443 LDKu8slice data_var = data;
12444 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
12445 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
12446 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12447 CHECK(obj != NULL);
12448 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
12449 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12450 (*env)->ExceptionDescribe(env);
12451 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
12453 if (get_jenv_res == JNI_EDETACHED) {
12454 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12458 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
12459 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12461 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12462 if (get_jenv_res == JNI_EDETACHED) {
12463 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12465 DO_ASSERT(get_jenv_res == JNI_OK);
12467 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12468 CHECK(obj != NULL);
12469 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
12470 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12471 (*env)->ExceptionDescribe(env);
12472 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
12474 if (get_jenv_res == JNI_EDETACHED) {
12475 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12478 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
12479 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12481 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12482 if (get_jenv_res == JNI_EDETACHED) {
12483 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12485 DO_ASSERT(get_jenv_res == JNI_OK);
12487 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12488 *other_arg_clone = SocketDescriptor_clone(other_arg);
12489 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12490 CHECK(obj != NULL);
12491 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (int64_t)other_arg_clone);
12492 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12493 (*env)->ExceptionDescribe(env);
12494 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
12496 if (get_jenv_res == JNI_EDETACHED) {
12497 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12501 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
12502 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
12504 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12505 if (get_jenv_res == JNI_EDETACHED) {
12506 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12508 DO_ASSERT(get_jenv_res == JNI_OK);
12510 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12511 CHECK(obj != NULL);
12512 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
12513 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12514 (*env)->ExceptionDescribe(env);
12515 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
12517 if (get_jenv_res == JNI_EDETACHED) {
12518 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12522 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
12523 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
12524 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12526 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
12527 jclass c = (*env)->GetObjectClass(env, o);
12529 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
12530 atomic_init(&calls->refcnt, 1);
12531 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12532 calls->o = (*env)->NewWeakGlobalRef(env, o);
12533 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
12534 CHECK(calls->send_data_meth != NULL);
12535 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
12536 CHECK(calls->disconnect_socket_meth != NULL);
12537 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
12538 CHECK(calls->eq_meth != NULL);
12539 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
12540 CHECK(calls->hash_meth != NULL);
12542 LDKSocketDescriptor ret = {
12543 .this_arg = (void*) calls,
12544 .send_data = send_data_LDKSocketDescriptor_jcall,
12545 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
12546 .eq = eq_LDKSocketDescriptor_jcall,
12547 .hash = hash_LDKSocketDescriptor_jcall,
12548 .cloned = LDKSocketDescriptor_JCalls_cloned,
12549 .free = LDKSocketDescriptor_JCalls_free,
12553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
12554 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12555 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
12556 return (uint64_t)res_ptr;
12558 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) {
12559 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12560 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12561 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12562 LDKu8slice data_ref;
12563 data_ref.datalen = (*env)->GetArrayLength(env, data);
12564 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
12565 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
12566 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
12570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
12571 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12572 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12573 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12574 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
12577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
12578 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12579 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12580 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
12581 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
12585 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
12586 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
12587 static jclass LDKEffectiveCapacity_MaximumHTLC_class = NULL;
12588 static jmethodID LDKEffectiveCapacity_MaximumHTLC_meth = NULL;
12589 static jclass LDKEffectiveCapacity_Total_class = NULL;
12590 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
12591 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
12592 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
12593 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
12594 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
12595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
12596 LDKEffectiveCapacity_ExactLiquidity_class =
12597 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
12598 CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
12599 LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
12600 CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
12601 LDKEffectiveCapacity_MaximumHTLC_class =
12602 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$MaximumHTLC"));
12603 CHECK(LDKEffectiveCapacity_MaximumHTLC_class != NULL);
12604 LDKEffectiveCapacity_MaximumHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_MaximumHTLC_class, "<init>", "(J)V");
12605 CHECK(LDKEffectiveCapacity_MaximumHTLC_meth != NULL);
12606 LDKEffectiveCapacity_Total_class =
12607 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
12608 CHECK(LDKEffectiveCapacity_Total_class != NULL);
12609 LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(J)V");
12610 CHECK(LDKEffectiveCapacity_Total_meth != NULL);
12611 LDKEffectiveCapacity_Infinite_class =
12612 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
12613 CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
12614 LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
12615 CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
12616 LDKEffectiveCapacity_Unknown_class =
12617 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
12618 CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
12619 LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
12620 CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
12622 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12623 LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)(ptr & ~1);
12625 case LDKEffectiveCapacity_ExactLiquidity: {
12626 return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, obj->exact_liquidity.liquidity_msat);
12628 case LDKEffectiveCapacity_MaximumHTLC: {
12629 return (*env)->NewObject(env, LDKEffectiveCapacity_MaximumHTLC_class, LDKEffectiveCapacity_MaximumHTLC_meth, obj->maximum_htlc.amount_msat);
12631 case LDKEffectiveCapacity_Total: {
12632 return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, obj->total.capacity_msat);
12634 case LDKEffectiveCapacity_Infinite: {
12635 return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
12637 case LDKEffectiveCapacity_Unknown: {
12638 return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
12643 typedef struct LDKScore_JCalls {
12644 atomic_size_t refcnt;
12647 jmethodID channel_penalty_msat_meth;
12648 jmethodID payment_path_failed_meth;
12649 jmethodID payment_path_successful_meth;
12650 jmethodID write_meth;
12652 static void LDKScore_JCalls_free(void* this_arg) {
12653 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12654 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12656 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12657 if (get_jenv_res == JNI_EDETACHED) {
12658 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12660 DO_ASSERT(get_jenv_res == JNI_OK);
12662 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12663 if (get_jenv_res == JNI_EDETACHED) {
12664 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12669 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) {
12670 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12672 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12673 if (get_jenv_res == JNI_EDETACHED) {
12674 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12676 DO_ASSERT(get_jenv_res == JNI_OK);
12678 LDKNodeId source_var = *source;
12679 int64_t source_ref = 0;
12680 source_var = NodeId_clone(&source_var);
12681 CHECK((((uintptr_t)source_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12682 CHECK((((uintptr_t)&source_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12683 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
12684 source_ref = (uintptr_t)source_var.inner;
12685 if (source_var.is_owned) {
12688 LDKNodeId target_var = *target;
12689 int64_t target_ref = 0;
12690 target_var = NodeId_clone(&target_var);
12691 CHECK((((uintptr_t)target_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12692 CHECK((((uintptr_t)&target_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12693 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
12694 target_ref = (uintptr_t)target_var.inner;
12695 if (target_var.is_owned) {
12698 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12699 CHECK(obj != NULL);
12700 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, capacity_msat, source_ref, target_ref);
12701 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12702 (*env)->ExceptionDescribe(env);
12703 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception.");
12705 if (get_jenv_res == JNI_EDETACHED) {
12706 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12710 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
12711 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12713 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12714 if (get_jenv_res == JNI_EDETACHED) {
12715 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12717 DO_ASSERT(get_jenv_res == JNI_OK);
12719 LDKCVec_RouteHopZ path_var = path;
12720 int64_tArray path_arr = NULL;
12721 path_arr = (*env)->NewLongArray(env, path_var.datalen);
12722 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
12723 for (size_t k = 0; k < path_var.datalen; k++) {
12724 LDKRouteHop path_conv_10_var = path_var.data[k];
12725 int64_t path_conv_10_ref = 0;
12726 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12727 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12728 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
12729 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
12730 if (path_conv_10_var.is_owned) {
12731 path_conv_10_ref |= 1;
12733 path_arr_ptr[k] = path_conv_10_ref;
12735 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
12736 FREE(path_var.data);
12737 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12738 CHECK(obj != NULL);
12739 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id);
12740 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12741 (*env)->ExceptionDescribe(env);
12742 (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception.");
12744 if (get_jenv_res == JNI_EDETACHED) {
12745 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12748 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
12749 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12751 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12752 if (get_jenv_res == JNI_EDETACHED) {
12753 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12755 DO_ASSERT(get_jenv_res == JNI_OK);
12757 LDKCVec_RouteHopZ path_var = path;
12758 int64_tArray path_arr = NULL;
12759 path_arr = (*env)->NewLongArray(env, path_var.datalen);
12760 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
12761 for (size_t k = 0; k < path_var.datalen; k++) {
12762 LDKRouteHop path_conv_10_var = path_var.data[k];
12763 int64_t path_conv_10_ref = 0;
12764 CHECK((((uintptr_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12765 CHECK((((uintptr_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12766 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
12767 path_conv_10_ref = (uintptr_t)path_conv_10_var.inner;
12768 if (path_conv_10_var.is_owned) {
12769 path_conv_10_ref |= 1;
12771 path_arr_ptr[k] = path_conv_10_ref;
12773 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
12774 FREE(path_var.data);
12775 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12776 CHECK(obj != NULL);
12777 (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr);
12778 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12779 (*env)->ExceptionDescribe(env);
12780 (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception.");
12782 if (get_jenv_res == JNI_EDETACHED) {
12783 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12786 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
12787 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
12789 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12790 if (get_jenv_res == JNI_EDETACHED) {
12791 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12793 DO_ASSERT(get_jenv_res == JNI_OK);
12795 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12796 CHECK(obj != NULL);
12797 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
12798 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12799 (*env)->ExceptionDescribe(env);
12800 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
12802 LDKCVec_u8Z ret_ref;
12803 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
12804 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
12805 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
12806 if (get_jenv_res == JNI_EDETACHED) {
12807 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12811 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
12812 LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
12813 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12815 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) {
12816 jclass c = (*env)->GetObjectClass(env, o);
12818 LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
12819 atomic_init(&calls->refcnt, 1);
12820 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12821 calls->o = (*env)->NewWeakGlobalRef(env, o);
12822 calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J");
12823 CHECK(calls->channel_penalty_msat_meth != NULL);
12824 calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V");
12825 CHECK(calls->payment_path_failed_meth != NULL);
12826 calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V");
12827 CHECK(calls->payment_path_successful_meth != NULL);
12828 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
12829 CHECK(calls->write_meth != NULL);
12832 .this_arg = (void*) calls,
12833 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
12834 .payment_path_failed = payment_path_failed_LDKScore_jcall,
12835 .payment_path_successful = payment_path_successful_LDKScore_jcall,
12836 .write = write_LDKScore_jcall,
12837 .free = LDKScore_JCalls_free,
12841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) {
12842 LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
12843 *res_ptr = LDKScore_init(env, clz, o);
12844 return (uint64_t)res_ptr;
12846 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) {
12847 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12848 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12849 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12850 LDKNodeId source_conv;
12851 source_conv.inner = (void*)(source & (~1));
12852 source_conv.is_owned = false;
12853 CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
12854 LDKNodeId target_conv;
12855 target_conv.inner = (void*)(target & (~1));
12856 target_conv.is_owned = false;
12857 CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
12858 int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, capacity_msat, &source_conv, &target_conv);
12862 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) {
12863 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12864 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12865 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12866 LDKCVec_RouteHopZ path_constr;
12867 path_constr.datalen = (*env)->GetArrayLength(env, path);
12868 if (path_constr.datalen > 0)
12869 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12871 path_constr.data = NULL;
12872 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
12873 for (size_t k = 0; k < path_constr.datalen; k++) {
12874 int64_t path_conv_10 = path_vals[k];
12875 LDKRouteHop path_conv_10_conv;
12876 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
12877 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
12878 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
12879 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
12880 path_constr.data[k] = path_conv_10_conv;
12882 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
12883 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
12886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) {
12887 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12888 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12889 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12890 LDKCVec_RouteHopZ path_constr;
12891 path_constr.datalen = (*env)->GetArrayLength(env, path);
12892 if (path_constr.datalen > 0)
12893 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12895 path_constr.data = NULL;
12896 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
12897 for (size_t k = 0; k < path_constr.datalen; k++) {
12898 int64_t path_conv_10 = path_vals[k];
12899 LDKRouteHop path_conv_10_conv;
12900 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
12901 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
12902 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
12903 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
12904 path_constr.data[k] = path_conv_10_conv;
12906 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
12907 (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
12910 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
12911 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
12912 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
12913 LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
12914 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
12915 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12916 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12917 CVec_u8Z_free(ret_var);
12921 typedef struct LDKLockableScore_JCalls {
12922 atomic_size_t refcnt;
12925 jmethodID lock_meth;
12926 } LDKLockableScore_JCalls;
12927 static void LDKLockableScore_JCalls_free(void* this_arg) {
12928 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12929 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12931 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12932 if (get_jenv_res == JNI_EDETACHED) {
12933 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12935 DO_ASSERT(get_jenv_res == JNI_OK);
12937 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
12938 if (get_jenv_res == JNI_EDETACHED) {
12939 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12944 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
12945 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
12947 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
12948 if (get_jenv_res == JNI_EDETACHED) {
12949 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
12951 DO_ASSERT(get_jenv_res == JNI_OK);
12953 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
12954 CHECK(obj != NULL);
12955 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth);
12956 if (UNLIKELY((*env)->ExceptionCheck(env))) {
12957 (*env)->ExceptionDescribe(env);
12958 (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception.");
12960 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
12961 CHECK_ACCESS(ret_ptr);
12962 LDKScore ret_conv = *(LDKScore*)(ret_ptr);
12963 if (ret_conv.free == LDKScore_JCalls_free) {
12964 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12965 LDKScore_JCalls_cloned(&ret_conv);
12966 }// WARNING: we may need a move here but no clone is available for LDKScore
12968 if (get_jenv_res == JNI_EDETACHED) {
12969 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
12973 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
12974 LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
12975 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12977 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
12978 jclass c = (*env)->GetObjectClass(env, o);
12980 LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
12981 atomic_init(&calls->refcnt, 1);
12982 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
12983 calls->o = (*env)->NewWeakGlobalRef(env, o);
12984 calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J");
12985 CHECK(calls->lock_meth != NULL);
12987 LDKLockableScore ret = {
12988 .this_arg = (void*) calls,
12989 .lock = lock_LDKLockableScore_jcall,
12990 .free = LDKLockableScore_JCalls_free,
12994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
12995 LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
12996 *res_ptr = LDKLockableScore_init(env, clz, o);
12997 return (uint64_t)res_ptr;
12999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
13000 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13001 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13002 LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
13003 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
13004 *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
13005 return (int64_t)ret_ret;
13008 typedef struct LDKChannelManagerPersister_JCalls {
13009 atomic_size_t refcnt;
13012 jmethodID persist_manager_meth;
13013 } LDKChannelManagerPersister_JCalls;
13014 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
13015 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
13016 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13018 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13019 if (get_jenv_res == JNI_EDETACHED) {
13020 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13022 DO_ASSERT(get_jenv_res == JNI_OK);
13024 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13025 if (get_jenv_res == JNI_EDETACHED) {
13026 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13031 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
13032 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
13034 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13035 if (get_jenv_res == JNI_EDETACHED) {
13036 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13038 DO_ASSERT(get_jenv_res == JNI_OK);
13040 LDKChannelManager channel_manager_var = *channel_manager;
13041 int64_t channel_manager_ref = 0;
13042 // WARNING: we may need a move here but no clone is available for LDKChannelManager
13043 CHECK((((uintptr_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13044 CHECK((((uintptr_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13045 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
13046 channel_manager_ref = (uintptr_t)channel_manager_var.inner;
13047 if (channel_manager_var.is_owned) {
13048 channel_manager_ref |= 1;
13050 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13051 CHECK(obj != NULL);
13052 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
13053 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13054 (*env)->ExceptionDescribe(env);
13055 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
13057 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13058 CHECK_ACCESS(ret_ptr);
13059 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
13061 if (get_jenv_res == JNI_EDETACHED) {
13062 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13066 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
13067 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
13068 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13070 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
13071 jclass c = (*env)->GetObjectClass(env, o);
13073 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
13074 atomic_init(&calls->refcnt, 1);
13075 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13076 calls->o = (*env)->NewWeakGlobalRef(env, o);
13077 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
13078 CHECK(calls->persist_manager_meth != NULL);
13080 LDKChannelManagerPersister ret = {
13081 .this_arg = (void*) calls,
13082 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
13083 .free = LDKChannelManagerPersister_JCalls_free,
13087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
13088 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
13089 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
13090 return (uint64_t)res_ptr;
13092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
13093 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13094 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13095 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr;
13096 LDKChannelManager channel_manager_conv;
13097 channel_manager_conv.inner = (void*)(channel_manager & (~1));
13098 channel_manager_conv.is_owned = false;
13099 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
13100 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
13101 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
13102 return (int64_t)ret_conv;
13105 static jclass LDKFallback_SegWitProgram_class = NULL;
13106 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
13107 static jclass LDKFallback_PubKeyHash_class = NULL;
13108 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
13109 static jclass LDKFallback_ScriptHash_class = NULL;
13110 static jmethodID LDKFallback_ScriptHash_meth = NULL;
13111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
13112 LDKFallback_SegWitProgram_class =
13113 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
13114 CHECK(LDKFallback_SegWitProgram_class != NULL);
13115 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
13116 CHECK(LDKFallback_SegWitProgram_meth != NULL);
13117 LDKFallback_PubKeyHash_class =
13118 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
13119 CHECK(LDKFallback_PubKeyHash_class != NULL);
13120 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
13121 CHECK(LDKFallback_PubKeyHash_meth != NULL);
13122 LDKFallback_ScriptHash_class =
13123 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
13124 CHECK(LDKFallback_ScriptHash_class != NULL);
13125 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
13126 CHECK(LDKFallback_ScriptHash_meth != NULL);
13128 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13129 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
13131 case LDKFallback_SegWitProgram: {
13132 uint8_t version_val = obj->seg_wit_program.version._0;
13133 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
13134 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
13135 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
13136 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
13138 case LDKFallback_PubKeyHash: {
13139 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
13140 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
13141 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
13143 case LDKFallback_ScriptHash: {
13144 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
13145 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
13146 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
13151 typedef struct LDKPayer_JCalls {
13152 atomic_size_t refcnt;
13155 jmethodID node_id_meth;
13156 jmethodID first_hops_meth;
13157 jmethodID send_payment_meth;
13158 jmethodID send_spontaneous_payment_meth;
13159 jmethodID retry_payment_meth;
13160 jmethodID abandon_payment_meth;
13162 static void LDKPayer_JCalls_free(void* this_arg) {
13163 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13164 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13166 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13167 if (get_jenv_res == JNI_EDETACHED) {
13168 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13170 DO_ASSERT(get_jenv_res == JNI_OK);
13172 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13173 if (get_jenv_res == JNI_EDETACHED) {
13174 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13179 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
13180 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13182 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13183 if (get_jenv_res == JNI_EDETACHED) {
13184 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13186 DO_ASSERT(get_jenv_res == JNI_OK);
13188 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13189 CHECK(obj != NULL);
13190 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth);
13191 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13192 (*env)->ExceptionDescribe(env);
13193 (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception.");
13195 LDKPublicKey ret_ref;
13196 CHECK((*env)->GetArrayLength(env, ret) == 33);
13197 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
13198 if (get_jenv_res == JNI_EDETACHED) {
13199 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13203 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
13204 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13206 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13207 if (get_jenv_res == JNI_EDETACHED) {
13208 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13210 DO_ASSERT(get_jenv_res == JNI_OK);
13212 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13213 CHECK(obj != NULL);
13214 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth);
13215 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13216 (*env)->ExceptionDescribe(env);
13217 (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception.");
13219 LDKCVec_ChannelDetailsZ ret_constr;
13220 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
13221 if (ret_constr.datalen > 0)
13222 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13224 ret_constr.data = NULL;
13225 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
13226 for (size_t q = 0; q < ret_constr.datalen; q++) {
13227 int64_t ret_conv_16 = ret_vals[q];
13228 LDKChannelDetails ret_conv_16_conv;
13229 ret_conv_16_conv.inner = (void*)(ret_conv_16 & (~1));
13230 ret_conv_16_conv.is_owned = (ret_conv_16 & 1) || (ret_conv_16 == 0);
13231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
13232 ret_constr.data[q] = ret_conv_16_conv;
13234 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
13235 if (get_jenv_res == JNI_EDETACHED) {
13236 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13240 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
13241 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13243 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13244 if (get_jenv_res == JNI_EDETACHED) {
13245 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13247 DO_ASSERT(get_jenv_res == JNI_OK);
13249 LDKRoute route_var = *route;
13250 int64_t route_ref = 0;
13251 route_var = Route_clone(&route_var);
13252 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13253 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13254 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13255 route_ref = (uintptr_t)route_var.inner;
13256 if (route_var.is_owned) {
13259 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13260 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, payment_hash.data);
13261 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
13262 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, payment_secret.data);
13263 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13264 CHECK(obj != NULL);
13265 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr);
13266 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13267 (*env)->ExceptionDescribe(env);
13268 (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception.");
13270 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13271 CHECK_ACCESS(ret_ptr);
13272 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13274 if (get_jenv_res == JNI_EDETACHED) {
13275 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13279 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
13280 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13282 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13283 if (get_jenv_res == JNI_EDETACHED) {
13284 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13286 DO_ASSERT(get_jenv_res == JNI_OK);
13288 LDKRoute route_var = *route;
13289 int64_t route_ref = 0;
13290 route_var = Route_clone(&route_var);
13291 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13292 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13293 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13294 route_ref = (uintptr_t)route_var.inner;
13295 if (route_var.is_owned) {
13298 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
13299 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data);
13300 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13301 CHECK(obj != NULL);
13302 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr);
13303 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13304 (*env)->ExceptionDescribe(env);
13305 (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception.");
13307 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13308 CHECK_ACCESS(ret_ptr);
13309 LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
13311 if (get_jenv_res == JNI_EDETACHED) {
13312 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13316 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
13317 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13319 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13320 if (get_jenv_res == JNI_EDETACHED) {
13321 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13323 DO_ASSERT(get_jenv_res == JNI_OK);
13325 LDKRoute route_var = *route;
13326 int64_t route_ref = 0;
13327 route_var = Route_clone(&route_var);
13328 CHECK((((uintptr_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13329 CHECK((((uintptr_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13330 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
13331 route_ref = (uintptr_t)route_var.inner;
13332 if (route_var.is_owned) {
13335 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13336 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13337 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13338 CHECK(obj != NULL);
13339 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr);
13340 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13341 (*env)->ExceptionDescribe(env);
13342 (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception.");
13344 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13345 CHECK_ACCESS(ret_ptr);
13346 LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
13348 if (get_jenv_res == JNI_EDETACHED) {
13349 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13353 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
13354 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
13356 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13357 if (get_jenv_res == JNI_EDETACHED) {
13358 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13360 DO_ASSERT(get_jenv_res == JNI_OK);
13362 int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
13363 (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data);
13364 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13365 CHECK(obj != NULL);
13366 (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr);
13367 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13368 (*env)->ExceptionDescribe(env);
13369 (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception.");
13371 if (get_jenv_res == JNI_EDETACHED) {
13372 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13375 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
13376 LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
13377 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13379 static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) {
13380 jclass c = (*env)->GetObjectClass(env, o);
13382 LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
13383 atomic_init(&calls->refcnt, 1);
13384 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13385 calls->o = (*env)->NewWeakGlobalRef(env, o);
13386 calls->node_id_meth = (*env)->GetMethodID(env, c, "node_id", "()[B");
13387 CHECK(calls->node_id_meth != NULL);
13388 calls->first_hops_meth = (*env)->GetMethodID(env, c, "first_hops", "()[J");
13389 CHECK(calls->first_hops_meth != NULL);
13390 calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J");
13391 CHECK(calls->send_payment_meth != NULL);
13392 calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J");
13393 CHECK(calls->send_spontaneous_payment_meth != NULL);
13394 calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J");
13395 CHECK(calls->retry_payment_meth != NULL);
13396 calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V");
13397 CHECK(calls->abandon_payment_meth != NULL);
13400 .this_arg = (void*) calls,
13401 .node_id = node_id_LDKPayer_jcall,
13402 .first_hops = first_hops_LDKPayer_jcall,
13403 .send_payment = send_payment_LDKPayer_jcall,
13404 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
13405 .retry_payment = retry_payment_LDKPayer_jcall,
13406 .abandon_payment = abandon_payment_LDKPayer_jcall,
13407 .free = LDKPayer_JCalls_free,
13411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPayer_1new(JNIEnv *env, jclass clz, jobject o) {
13412 LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
13413 *res_ptr = LDKPayer_init(env, clz, o);
13414 return (uint64_t)res_ptr;
13416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13417 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13418 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13419 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13420 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
13421 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form);
13425 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops(JNIEnv *env, jclass clz, int64_t this_arg) {
13426 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13427 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13428 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13429 LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
13430 int64_tArray ret_arr = NULL;
13431 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13432 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
13433 for (size_t q = 0; q < ret_var.datalen; q++) {
13434 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
13435 int64_t ret_conv_16_ref = 0;
13436 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13437 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13438 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
13439 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
13440 if (ret_conv_16_var.is_owned) {
13441 ret_conv_16_ref |= 1;
13443 ret_arr_ptr[q] = ret_conv_16_ref;
13445 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
13446 FREE(ret_var.data);
13450 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) {
13451 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13452 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13453 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13454 LDKRoute route_conv;
13455 route_conv.inner = (void*)(route & (~1));
13456 route_conv.is_owned = false;
13457 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13458 LDKThirtyTwoBytes payment_hash_ref;
13459 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13460 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13461 LDKThirtyTwoBytes payment_secret_ref;
13462 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
13463 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
13464 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13465 *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
13466 return (int64_t)ret_conv;
13469 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) {
13470 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13471 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13472 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13473 LDKRoute route_conv;
13474 route_conv.inner = (void*)(route & (~1));
13475 route_conv.is_owned = false;
13476 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13477 LDKThirtyTwoBytes payment_preimage_ref;
13478 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13479 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13480 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
13481 *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
13482 return (int64_t)ret_conv;
13485 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) {
13486 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13487 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13488 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13489 LDKRoute route_conv;
13490 route_conv.inner = (void*)(route & (~1));
13491 route_conv.is_owned = false;
13492 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
13493 LDKThirtyTwoBytes payment_id_ref;
13494 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13495 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13496 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
13497 *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
13498 return (int64_t)ret_conv;
13501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
13502 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13503 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13504 LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
13505 LDKThirtyTwoBytes payment_id_ref;
13506 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
13507 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
13508 (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
13511 typedef struct LDKRouter_JCalls {
13512 atomic_size_t refcnt;
13515 jmethodID find_route_meth;
13516 } LDKRouter_JCalls;
13517 static void LDKRouter_JCalls_free(void* this_arg) {
13518 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13519 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13521 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13522 if (get_jenv_res == JNI_EDETACHED) {
13523 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13525 DO_ASSERT(get_jenv_res == JNI_OK);
13527 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
13528 if (get_jenv_res == JNI_EDETACHED) {
13529 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13534 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) {
13535 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
13537 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
13538 if (get_jenv_res == JNI_EDETACHED) {
13539 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
13541 DO_ASSERT(get_jenv_res == JNI_OK);
13543 int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
13544 (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
13545 LDKRouteParameters route_params_var = *route_params;
13546 int64_t route_params_ref = 0;
13547 route_params_var = RouteParameters_clone(&route_params_var);
13548 CHECK((((uintptr_t)route_params_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13549 CHECK((((uintptr_t)&route_params_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13550 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
13551 route_params_ref = (uintptr_t)route_params_var.inner;
13552 if (route_params_var.is_owned) {
13553 route_params_ref |= 1;
13555 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
13556 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash);
13557 LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
13558 int64_tArray first_hops_arr = NULL;
13559 if (first_hops != NULL) {
13560 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
13561 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
13562 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
13563 for (size_t q = 0; q < first_hops_var.datalen; q++) {
13564 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
13565 int64_t first_hops_conv_16_ref = 0;
13566 CHECK((((uintptr_t)first_hops_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13567 CHECK((((uintptr_t)&first_hops_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13568 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
13569 first_hops_conv_16_ref = (uintptr_t)first_hops_conv_16_var.inner;
13570 if (first_hops_conv_16_var.is_owned) {
13571 first_hops_conv_16_ref |= 1;
13573 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
13575 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
13577 // WARNING: This object doesn't live past this scope, needs clone!
13578 int64_t ret_scorer = ((uintptr_t)scorer) | 1;
13579 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
13580 CHECK(obj != NULL);
13581 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);
13582 if (UNLIKELY((*env)->ExceptionCheck(env))) {
13583 (*env)->ExceptionDescribe(env);
13584 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
13586 void* ret_ptr = (void*)(((uintptr_t)ret) & ~1);
13587 CHECK_ACCESS(ret_ptr);
13588 LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
13590 if (get_jenv_res == JNI_EDETACHED) {
13591 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
13595 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
13596 LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
13597 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13599 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) {
13600 jclass c = (*env)->GetObjectClass(env, o);
13602 LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
13603 atomic_init(&calls->refcnt, 1);
13604 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
13605 calls->o = (*env)->NewWeakGlobalRef(env, o);
13606 calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J");
13607 CHECK(calls->find_route_meth != NULL);
13610 .this_arg = (void*) calls,
13611 .find_route = find_route_LDKRouter_jcall,
13612 .free = LDKRouter_JCalls_free,
13616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o) {
13617 LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
13618 *res_ptr = LDKRouter_init(env, clz, o);
13619 return (uint64_t)res_ptr;
13621 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) {
13622 void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1);
13623 if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); }
13624 LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
13625 LDKPublicKey payer_ref;
13626 CHECK((*env)->GetArrayLength(env, payer) == 33);
13627 (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
13628 LDKRouteParameters route_params_conv;
13629 route_params_conv.inner = (void*)(route_params & (~1));
13630 route_params_conv.is_owned = false;
13631 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
13632 unsigned char payment_hash_arr[32];
13633 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13634 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
13635 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
13636 LDKCVec_ChannelDetailsZ first_hops_constr;
13637 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
13638 if (first_hops != NULL) {
13639 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
13640 if (first_hops_constr.datalen > 0)
13641 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13643 first_hops_constr.data = NULL;
13644 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
13645 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13646 int64_t first_hops_conv_16 = first_hops_vals[q];
13647 LDKChannelDetails first_hops_conv_16_conv;
13648 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
13649 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
13650 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
13651 first_hops_constr.data[q] = first_hops_conv_16_conv;
13653 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
13654 first_hops_ptr = &first_hops_constr;
13656 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
13657 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
13658 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
13659 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13660 *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);
13661 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
13662 return (int64_t)ret_conv;
13665 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13666 LDKStr ret_str = _ldk_get_compiled_version();
13667 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13672 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
13673 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
13674 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
13679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
13680 LDKTransaction _res_ref;
13681 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
13682 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
13683 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
13684 _res_ref.data_is_owned = true;
13685 Transaction_free(_res_ref);
13688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
13689 LDKCVec_u8Z script_pubkey_ref;
13690 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
13691 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
13692 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
13693 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13694 *ret_ref = TxOut_new(script_pubkey_ref, value);
13695 return (int64_t)ret_ref;
13698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
13699 if ((_res & 1) != 0) return;
13700 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13701 CHECK_ACCESS(_res_ptr);
13702 LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
13704 TxOut_free(_res_conv);
13707 static inline uintptr_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
13708 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13709 *ret_ref = TxOut_clone(arg);
13710 return (int64_t)ret_ref;
13712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13713 LDKTxOut* arg_conv = (LDKTxOut*)(arg & ~1);
13714 int64_t ret_val = TxOut_clone_ptr(arg_conv);
13718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13719 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
13720 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13721 *ret_ref = TxOut_clone(orig_conv);
13722 return (int64_t)ret_ref;
13725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
13726 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
13730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
13731 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13732 *ret_conv = CResult_NoneNoneZ_ok();
13733 return (int64_t)ret_conv;
13736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
13737 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13738 *ret_conv = CResult_NoneNoneZ_err();
13739 return (int64_t)ret_conv;
13742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13743 LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)(o & ~1);
13744 jboolean ret_val = CResult_NoneNoneZ_is_ok(o_conv);
13748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13749 if ((_res & 1) != 0) return;
13750 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13751 CHECK_ACCESS(_res_ptr);
13752 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
13754 CResult_NoneNoneZ_free(_res_conv);
13757 static inline uintptr_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
13758 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13759 *ret_conv = CResult_NoneNoneZ_clone(arg);
13760 return (int64_t)ret_conv;
13762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13763 LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)(arg & ~1);
13764 int64_t ret_val = CResult_NoneNoneZ_clone_ptr(arg_conv);
13768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13769 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
13770 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13771 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
13772 return (int64_t)ret_conv;
13775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13776 LDKCounterpartyCommitmentSecrets o_conv;
13777 o_conv.inner = (void*)(o & (~1));
13778 o_conv.is_owned = (o & 1) || (o == 0);
13779 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13780 o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
13781 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13782 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
13783 return (int64_t)ret_conv;
13786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13787 LDKDecodeError e_conv;
13788 e_conv.inner = (void*)(e & (~1));
13789 e_conv.is_owned = (e & 1) || (e == 0);
13790 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13791 e_conv = DecodeError_clone(&e_conv);
13792 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13793 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
13794 return (int64_t)ret_conv;
13797 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13798 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(o & ~1);
13799 jboolean ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
13803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13804 if ((_res & 1) != 0) return;
13805 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13806 CHECK_ACCESS(_res_ptr);
13807 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
13809 CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
13812 static inline uintptr_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
13813 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13814 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
13815 return (int64_t)ret_conv;
13817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13818 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(arg & ~1);
13819 int64_t ret_val = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
13823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13824 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(orig & ~1);
13825 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
13826 *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
13827 return (int64_t)ret_conv;
13830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13831 LDKSecretKey o_ref;
13832 CHECK((*env)->GetArrayLength(env, o) == 32);
13833 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
13834 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13835 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
13836 return (int64_t)ret_conv;
13839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13840 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13841 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13842 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
13843 return (int64_t)ret_conv;
13846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13847 LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)(o & ~1);
13848 jboolean ret_val = CResult_SecretKeyErrorZ_is_ok(o_conv);
13852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13853 if ((_res & 1) != 0) return;
13854 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13855 CHECK_ACCESS(_res_ptr);
13856 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
13858 CResult_SecretKeyErrorZ_free(_res_conv);
13861 static inline uintptr_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
13862 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13863 *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
13864 return (int64_t)ret_conv;
13866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13867 LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
13868 int64_t ret_val = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
13872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13873 LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)(orig & ~1);
13874 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
13875 *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
13876 return (int64_t)ret_conv;
13879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13880 LDKPublicKey o_ref;
13881 CHECK((*env)->GetArrayLength(env, o) == 33);
13882 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
13883 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13884 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
13885 return (int64_t)ret_conv;
13888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
13889 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
13890 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13891 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
13892 return (int64_t)ret_conv;
13895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13896 LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)(o & ~1);
13897 jboolean ret_val = CResult_PublicKeyErrorZ_is_ok(o_conv);
13901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13902 if ((_res & 1) != 0) return;
13903 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13904 CHECK_ACCESS(_res_ptr);
13905 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
13907 CResult_PublicKeyErrorZ_free(_res_conv);
13910 static inline uintptr_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
13911 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13912 *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
13913 return (int64_t)ret_conv;
13915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13916 LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
13917 int64_t ret_val = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
13921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13922 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
13923 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13924 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
13925 return (int64_t)ret_conv;
13928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13929 LDKTxCreationKeys o_conv;
13930 o_conv.inner = (void*)(o & (~1));
13931 o_conv.is_owned = (o & 1) || (o == 0);
13932 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13933 o_conv = TxCreationKeys_clone(&o_conv);
13934 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13935 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
13936 return (int64_t)ret_conv;
13939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13940 LDKDecodeError e_conv;
13941 e_conv.inner = (void*)(e & (~1));
13942 e_conv.is_owned = (e & 1) || (e == 0);
13943 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13944 e_conv = DecodeError_clone(&e_conv);
13945 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13946 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
13947 return (int64_t)ret_conv;
13950 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
13951 LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(o & ~1);
13952 jboolean ret_val = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
13956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13957 if ((_res & 1) != 0) return;
13958 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
13959 CHECK_ACCESS(_res_ptr);
13960 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
13962 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
13965 static inline uintptr_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
13966 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13967 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
13968 return (int64_t)ret_conv;
13970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
13971 LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
13972 int64_t ret_val = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
13976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13977 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
13978 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
13979 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
13980 return (int64_t)ret_conv;
13983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13984 LDKChannelPublicKeys o_conv;
13985 o_conv.inner = (void*)(o & (~1));
13986 o_conv.is_owned = (o & 1) || (o == 0);
13987 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13988 o_conv = ChannelPublicKeys_clone(&o_conv);
13989 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
13990 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
13991 return (int64_t)ret_conv;
13994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13995 LDKDecodeError e_conv;
13996 e_conv.inner = (void*)(e & (~1));
13997 e_conv.is_owned = (e & 1) || (e == 0);
13998 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13999 e_conv = DecodeError_clone(&e_conv);
14000 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14001 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
14002 return (int64_t)ret_conv;
14005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14006 LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(o & ~1);
14007 jboolean ret_val = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
14011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14012 if ((_res & 1) != 0) return;
14013 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14014 CHECK_ACCESS(_res_ptr);
14015 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
14017 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
14020 static inline uintptr_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
14021 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14022 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
14023 return (int64_t)ret_conv;
14025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14026 LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
14027 int64_t ret_val = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
14031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14032 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
14033 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14034 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
14035 return (int64_t)ret_conv;
14038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14039 LDKTxCreationKeys o_conv;
14040 o_conv.inner = (void*)(o & (~1));
14041 o_conv.is_owned = (o & 1) || (o == 0);
14042 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14043 o_conv = TxCreationKeys_clone(&o_conv);
14044 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14045 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
14046 return (int64_t)ret_conv;
14049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14050 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
14051 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14052 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
14053 return (int64_t)ret_conv;
14056 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14057 LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)(o & ~1);
14058 jboolean ret_val = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
14062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14063 if ((_res & 1) != 0) return;
14064 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14065 CHECK_ACCESS(_res_ptr);
14066 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
14068 CResult_TxCreationKeysErrorZ_free(_res_conv);
14071 static inline uintptr_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
14072 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14073 *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
14074 return (int64_t)ret_conv;
14076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14077 LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
14078 int64_t ret_val = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
14082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14083 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
14084 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
14085 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
14086 return (int64_t)ret_conv;
14089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
14090 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14091 *ret_copy = COption_u32Z_some(o);
14092 int64_t ret_ref = (uintptr_t)ret_copy;
14096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
14097 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14098 *ret_copy = COption_u32Z_none();
14099 int64_t ret_ref = (uintptr_t)ret_copy;
14103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
14104 if ((_res & 1) != 0) return;
14105 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14106 CHECK_ACCESS(_res_ptr);
14107 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
14109 COption_u32Z_free(_res_conv);
14112 static inline uintptr_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
14113 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14114 *ret_copy = COption_u32Z_clone(arg);
14115 int64_t ret_ref = (uintptr_t)ret_copy;
14118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14119 LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)arg;
14120 int64_t ret_val = COption_u32Z_clone_ptr(arg_conv);
14124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14125 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
14126 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
14127 *ret_copy = COption_u32Z_clone(orig_conv);
14128 int64_t ret_ref = (uintptr_t)ret_copy;
14132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14133 LDKHTLCOutputInCommitment o_conv;
14134 o_conv.inner = (void*)(o & (~1));
14135 o_conv.is_owned = (o & 1) || (o == 0);
14136 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14137 o_conv = HTLCOutputInCommitment_clone(&o_conv);
14138 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14139 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
14140 return (int64_t)ret_conv;
14143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14144 LDKDecodeError e_conv;
14145 e_conv.inner = (void*)(e & (~1));
14146 e_conv.is_owned = (e & 1) || (e == 0);
14147 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14148 e_conv = DecodeError_clone(&e_conv);
14149 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14150 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
14151 return (int64_t)ret_conv;
14154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14155 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(o & ~1);
14156 jboolean ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
14160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14161 if ((_res & 1) != 0) return;
14162 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14163 CHECK_ACCESS(_res_ptr);
14164 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
14166 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
14169 static inline uintptr_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
14170 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14171 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
14172 return (int64_t)ret_conv;
14174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14175 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
14176 int64_t ret_val = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
14180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14181 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
14182 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
14183 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
14184 return (int64_t)ret_conv;
14187 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
14188 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
14192 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
14193 jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
14197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
14198 LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
14199 COption_NoneZ_free(_res_conv);
14202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14203 LDKCounterpartyChannelTransactionParameters o_conv;
14204 o_conv.inner = (void*)(o & (~1));
14205 o_conv.is_owned = (o & 1) || (o == 0);
14206 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14207 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
14208 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14209 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14210 return (int64_t)ret_conv;
14213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14214 LDKDecodeError e_conv;
14215 e_conv.inner = (void*)(e & (~1));
14216 e_conv.is_owned = (e & 1) || (e == 0);
14217 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14218 e_conv = DecodeError_clone(&e_conv);
14219 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14220 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
14221 return (int64_t)ret_conv;
14224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14225 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(o & ~1);
14226 jboolean ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14231 if ((_res & 1) != 0) return;
14232 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14233 CHECK_ACCESS(_res_ptr);
14234 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14236 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14239 static inline uintptr_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14240 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14241 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
14242 return (int64_t)ret_conv;
14244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14245 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
14246 int64_t ret_val = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14251 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
14252 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
14253 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14254 return (int64_t)ret_conv;
14257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14258 LDKChannelTransactionParameters o_conv;
14259 o_conv.inner = (void*)(o & (~1));
14260 o_conv.is_owned = (o & 1) || (o == 0);
14261 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14262 o_conv = ChannelTransactionParameters_clone(&o_conv);
14263 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14264 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
14265 return (int64_t)ret_conv;
14268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14269 LDKDecodeError e_conv;
14270 e_conv.inner = (void*)(e & (~1));
14271 e_conv.is_owned = (e & 1) || (e == 0);
14272 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14273 e_conv = DecodeError_clone(&e_conv);
14274 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14275 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
14276 return (int64_t)ret_conv;
14279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14280 LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(o & ~1);
14281 jboolean ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
14285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14286 if ((_res & 1) != 0) return;
14287 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14288 CHECK_ACCESS(_res_ptr);
14289 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
14291 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
14294 static inline uintptr_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
14295 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14296 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
14297 return (int64_t)ret_conv;
14299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14300 LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
14301 int64_t ret_val = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
14305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14306 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
14307 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
14308 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
14309 return (int64_t)ret_conv;
14312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14313 LDKCVec_SignatureZ _res_constr;
14314 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14315 if (_res_constr.datalen > 0)
14316 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14318 _res_constr.data = NULL;
14319 for (size_t i = 0; i < _res_constr.datalen; i++) {
14320 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
14321 LDKSignature _res_conv_8_ref;
14322 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
14323 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
14324 _res_constr.data[i] = _res_conv_8_ref;
14326 CVec_SignatureZ_free(_res_constr);
14329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14330 LDKHolderCommitmentTransaction o_conv;
14331 o_conv.inner = (void*)(o & (~1));
14332 o_conv.is_owned = (o & 1) || (o == 0);
14333 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14334 o_conv = HolderCommitmentTransaction_clone(&o_conv);
14335 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14336 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
14337 return (int64_t)ret_conv;
14340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14341 LDKDecodeError e_conv;
14342 e_conv.inner = (void*)(e & (~1));
14343 e_conv.is_owned = (e & 1) || (e == 0);
14344 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14345 e_conv = DecodeError_clone(&e_conv);
14346 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14347 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
14348 return (int64_t)ret_conv;
14351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14352 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(o & ~1);
14353 jboolean ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14358 if ((_res & 1) != 0) return;
14359 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14360 CHECK_ACCESS(_res_ptr);
14361 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14363 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
14366 static inline uintptr_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14367 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14368 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
14369 return (int64_t)ret_conv;
14371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14372 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
14373 int64_t ret_val = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14378 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
14379 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
14380 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14381 return (int64_t)ret_conv;
14384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14385 LDKBuiltCommitmentTransaction o_conv;
14386 o_conv.inner = (void*)(o & (~1));
14387 o_conv.is_owned = (o & 1) || (o == 0);
14388 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14389 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
14390 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14391 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
14392 return (int64_t)ret_conv;
14395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14396 LDKDecodeError e_conv;
14397 e_conv.inner = (void*)(e & (~1));
14398 e_conv.is_owned = (e & 1) || (e == 0);
14399 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14400 e_conv = DecodeError_clone(&e_conv);
14401 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14402 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
14403 return (int64_t)ret_conv;
14406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14407 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(o & ~1);
14408 jboolean ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14413 if ((_res & 1) != 0) return;
14414 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14415 CHECK_ACCESS(_res_ptr);
14416 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
14418 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
14421 static inline uintptr_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14422 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14423 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
14424 return (int64_t)ret_conv;
14426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14427 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
14428 int64_t ret_val = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14433 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
14434 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
14435 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
14436 return (int64_t)ret_conv;
14439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14440 LDKTrustedClosingTransaction o_conv;
14441 o_conv.inner = (void*)(o & (~1));
14442 o_conv.is_owned = (o & 1) || (o == 0);
14443 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14444 // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
14445 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14446 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
14447 return (int64_t)ret_conv;
14450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14451 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
14452 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
14453 return (int64_t)ret_conv;
14456 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14457 LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)(o & ~1);
14458 jboolean ret_val = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
14462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14463 if ((_res & 1) != 0) return;
14464 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14465 CHECK_ACCESS(_res_ptr);
14466 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
14468 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
14471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14472 LDKCommitmentTransaction o_conv;
14473 o_conv.inner = (void*)(o & (~1));
14474 o_conv.is_owned = (o & 1) || (o == 0);
14475 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14476 o_conv = CommitmentTransaction_clone(&o_conv);
14477 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14478 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
14479 return (int64_t)ret_conv;
14482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14483 LDKDecodeError e_conv;
14484 e_conv.inner = (void*)(e & (~1));
14485 e_conv.is_owned = (e & 1) || (e == 0);
14486 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14487 e_conv = DecodeError_clone(&e_conv);
14488 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14489 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
14490 return (int64_t)ret_conv;
14493 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14494 LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(o & ~1);
14495 jboolean ret_val = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
14499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14500 if ((_res & 1) != 0) return;
14501 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14502 CHECK_ACCESS(_res_ptr);
14503 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
14505 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
14508 static inline uintptr_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
14509 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14510 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
14511 return (int64_t)ret_conv;
14513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14514 LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
14515 int64_t ret_val = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
14519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14520 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
14521 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
14522 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
14523 return (int64_t)ret_conv;
14526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14527 LDKTrustedCommitmentTransaction o_conv;
14528 o_conv.inner = (void*)(o & (~1));
14529 o_conv.is_owned = (o & 1) || (o == 0);
14530 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14531 // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
14532 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14533 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
14534 return (int64_t)ret_conv;
14537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
14538 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
14539 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
14540 return (int64_t)ret_conv;
14543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14544 LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(o & ~1);
14545 jboolean ret_val = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
14549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14550 if ((_res & 1) != 0) return;
14551 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14552 CHECK_ACCESS(_res_ptr);
14553 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
14555 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
14558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
14559 LDKCVec_SignatureZ o_constr;
14560 o_constr.datalen = (*env)->GetArrayLength(env, o);
14561 if (o_constr.datalen > 0)
14562 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
14564 o_constr.data = NULL;
14565 for (size_t i = 0; i < o_constr.datalen; i++) {
14566 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
14567 LDKSignature o_conv_8_ref;
14568 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
14569 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
14570 o_constr.data[i] = o_conv_8_ref;
14572 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14573 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
14574 return (int64_t)ret_conv;
14577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
14578 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14579 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
14580 return (int64_t)ret_conv;
14583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14584 LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)(o & ~1);
14585 jboolean ret_val = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
14589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14590 if ((_res & 1) != 0) return;
14591 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14592 CHECK_ACCESS(_res_ptr);
14593 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
14595 CResult_CVec_SignatureZNoneZ_free(_res_conv);
14598 static inline uintptr_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
14599 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14600 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
14601 return (int64_t)ret_conv;
14603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14604 LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
14605 int64_t ret_val = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
14609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14610 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
14611 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
14612 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
14613 return (int64_t)ret_conv;
14616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14617 LDKShutdownScript o_conv;
14618 o_conv.inner = (void*)(o & (~1));
14619 o_conv.is_owned = (o & 1) || (o == 0);
14620 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14621 o_conv = ShutdownScript_clone(&o_conv);
14622 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14623 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
14624 return (int64_t)ret_conv;
14627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14628 LDKDecodeError e_conv;
14629 e_conv.inner = (void*)(e & (~1));
14630 e_conv.is_owned = (e & 1) || (e == 0);
14631 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14632 e_conv = DecodeError_clone(&e_conv);
14633 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14634 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
14635 return (int64_t)ret_conv;
14638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14639 LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(o & ~1);
14640 jboolean ret_val = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
14644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14645 if ((_res & 1) != 0) return;
14646 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14647 CHECK_ACCESS(_res_ptr);
14648 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
14650 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
14653 static inline uintptr_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
14654 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14655 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
14656 return (int64_t)ret_conv;
14658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14659 LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
14660 int64_t ret_val = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
14664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14665 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
14666 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
14667 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
14668 return (int64_t)ret_conv;
14671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14672 LDKShutdownScript o_conv;
14673 o_conv.inner = (void*)(o & (~1));
14674 o_conv.is_owned = (o & 1) || (o == 0);
14675 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14676 o_conv = ShutdownScript_clone(&o_conv);
14677 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14678 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
14679 return (int64_t)ret_conv;
14682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14683 LDKInvalidShutdownScript e_conv;
14684 e_conv.inner = (void*)(e & (~1));
14685 e_conv.is_owned = (e & 1) || (e == 0);
14686 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14687 e_conv = InvalidShutdownScript_clone(&e_conv);
14688 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14689 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
14690 return (int64_t)ret_conv;
14693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14694 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(o & ~1);
14695 jboolean ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
14699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14700 if ((_res & 1) != 0) return;
14701 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14702 CHECK_ACCESS(_res_ptr);
14703 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
14705 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
14708 static inline uintptr_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
14709 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14710 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
14711 return (int64_t)ret_conv;
14713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14714 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
14715 int64_t ret_val = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
14719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14720 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(orig & ~1);
14721 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
14722 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
14723 return (int64_t)ret_conv;
14726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
14727 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14728 *ret_conv = CResult_NoneErrorZ_ok();
14729 return (int64_t)ret_conv;
14732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
14733 LDKIOError e_conv = LDKIOError_from_java(env, e);
14734 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14735 *ret_conv = CResult_NoneErrorZ_err(e_conv);
14736 return (int64_t)ret_conv;
14739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14740 LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)(o & ~1);
14741 jboolean ret_val = CResult_NoneErrorZ_is_ok(o_conv);
14745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14746 if ((_res & 1) != 0) return;
14747 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14748 CHECK_ACCESS(_res_ptr);
14749 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
14751 CResult_NoneErrorZ_free(_res_conv);
14754 static inline uintptr_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
14755 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14756 *ret_conv = CResult_NoneErrorZ_clone(arg);
14757 return (int64_t)ret_conv;
14759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14760 LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)(arg & ~1);
14761 int64_t ret_val = CResult_NoneErrorZ_clone_ptr(arg_conv);
14765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14766 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
14767 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
14768 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
14769 return (int64_t)ret_conv;
14772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14773 LDKRouteHop o_conv;
14774 o_conv.inner = (void*)(o & (~1));
14775 o_conv.is_owned = (o & 1) || (o == 0);
14776 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14777 o_conv = RouteHop_clone(&o_conv);
14778 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14779 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
14780 return (int64_t)ret_conv;
14783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14784 LDKDecodeError e_conv;
14785 e_conv.inner = (void*)(e & (~1));
14786 e_conv.is_owned = (e & 1) || (e == 0);
14787 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14788 e_conv = DecodeError_clone(&e_conv);
14789 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14790 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
14791 return (int64_t)ret_conv;
14794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14795 LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)(o & ~1);
14796 jboolean ret_val = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
14800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14801 if ((_res & 1) != 0) return;
14802 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14803 CHECK_ACCESS(_res_ptr);
14804 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
14806 CResult_RouteHopDecodeErrorZ_free(_res_conv);
14809 static inline uintptr_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
14810 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14811 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
14812 return (int64_t)ret_conv;
14814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14815 LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
14816 int64_t ret_val = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
14820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14821 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
14822 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
14823 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
14824 return (int64_t)ret_conv;
14827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14828 LDKCVec_RouteHopZ _res_constr;
14829 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14830 if (_res_constr.datalen > 0)
14831 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14833 _res_constr.data = NULL;
14834 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14835 for (size_t k = 0; k < _res_constr.datalen; k++) {
14836 int64_t _res_conv_10 = _res_vals[k];
14837 LDKRouteHop _res_conv_10_conv;
14838 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
14839 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
14840 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
14841 _res_constr.data[k] = _res_conv_10_conv;
14843 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
14844 CVec_RouteHopZ_free(_res_constr);
14847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
14848 LDKCVec_CVec_RouteHopZZ _res_constr;
14849 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14850 if (_res_constr.datalen > 0)
14851 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
14853 _res_constr.data = NULL;
14854 for (size_t m = 0; m < _res_constr.datalen; m++) {
14855 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
14856 LDKCVec_RouteHopZ _res_conv_12_constr;
14857 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
14858 if (_res_conv_12_constr.datalen > 0)
14859 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14861 _res_conv_12_constr.data = NULL;
14862 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
14863 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
14864 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
14865 LDKRouteHop _res_conv_12_conv_10_conv;
14866 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
14867 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
14868 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
14869 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
14871 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
14872 _res_constr.data[m] = _res_conv_12_constr;
14874 CVec_CVec_RouteHopZZ_free(_res_constr);
14877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14879 o_conv.inner = (void*)(o & (~1));
14880 o_conv.is_owned = (o & 1) || (o == 0);
14881 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14882 o_conv = Route_clone(&o_conv);
14883 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14884 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
14885 return (int64_t)ret_conv;
14888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14889 LDKDecodeError e_conv;
14890 e_conv.inner = (void*)(e & (~1));
14891 e_conv.is_owned = (e & 1) || (e == 0);
14892 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14893 e_conv = DecodeError_clone(&e_conv);
14894 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14895 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
14896 return (int64_t)ret_conv;
14899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14900 LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)(o & ~1);
14901 jboolean ret_val = CResult_RouteDecodeErrorZ_is_ok(o_conv);
14905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14906 if ((_res & 1) != 0) return;
14907 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14908 CHECK_ACCESS(_res_ptr);
14909 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
14911 CResult_RouteDecodeErrorZ_free(_res_conv);
14914 static inline uintptr_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
14915 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14916 *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
14917 return (int64_t)ret_conv;
14919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14920 LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
14921 int64_t ret_val = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
14925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14926 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
14927 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
14928 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
14929 return (int64_t)ret_conv;
14932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14933 LDKRouteParameters o_conv;
14934 o_conv.inner = (void*)(o & (~1));
14935 o_conv.is_owned = (o & 1) || (o == 0);
14936 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14937 o_conv = RouteParameters_clone(&o_conv);
14938 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14939 *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
14940 return (int64_t)ret_conv;
14943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14944 LDKDecodeError e_conv;
14945 e_conv.inner = (void*)(e & (~1));
14946 e_conv.is_owned = (e & 1) || (e == 0);
14947 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14948 e_conv = DecodeError_clone(&e_conv);
14949 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14950 *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
14951 return (int64_t)ret_conv;
14954 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
14955 LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(o & ~1);
14956 jboolean ret_val = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
14960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14961 if ((_res & 1) != 0) return;
14962 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
14963 CHECK_ACCESS(_res_ptr);
14964 LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
14966 CResult_RouteParametersDecodeErrorZ_free(_res_conv);
14969 static inline uintptr_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
14970 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14971 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
14972 return (int64_t)ret_conv;
14974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
14975 LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(arg & ~1);
14976 int64_t ret_val = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
14980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14981 LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)(orig & ~1);
14982 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
14983 *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
14984 return (int64_t)ret_conv;
14987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
14988 LDKCVec_RouteHintZ _res_constr;
14989 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
14990 if (_res_constr.datalen > 0)
14991 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
14993 _res_constr.data = NULL;
14994 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
14995 for (size_t l = 0; l < _res_constr.datalen; l++) {
14996 int64_t _res_conv_11 = _res_vals[l];
14997 LDKRouteHint _res_conv_11_conv;
14998 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
14999 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
15000 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
15001 _res_constr.data[l] = _res_conv_11_conv;
15003 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15004 CVec_RouteHintZ_free(_res_constr);
15007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
15008 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15009 *ret_copy = COption_u64Z_some(o);
15010 int64_t ret_ref = (uintptr_t)ret_copy;
15014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
15015 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15016 *ret_copy = COption_u64Z_none();
15017 int64_t ret_ref = (uintptr_t)ret_copy;
15021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
15022 if ((_res & 1) != 0) return;
15023 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15024 CHECK_ACCESS(_res_ptr);
15025 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
15027 COption_u64Z_free(_res_conv);
15030 static inline uintptr_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
15031 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15032 *ret_copy = COption_u64Z_clone(arg);
15033 int64_t ret_ref = (uintptr_t)ret_copy;
15036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15037 LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)arg;
15038 int64_t ret_val = COption_u64Z_clone_ptr(arg_conv);
15042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15043 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
15044 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15045 *ret_copy = COption_u64Z_clone(orig_conv);
15046 int64_t ret_ref = (uintptr_t)ret_copy;
15050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15051 LDKPaymentParameters o_conv;
15052 o_conv.inner = (void*)(o & (~1));
15053 o_conv.is_owned = (o & 1) || (o == 0);
15054 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15055 o_conv = PaymentParameters_clone(&o_conv);
15056 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15057 *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
15058 return (int64_t)ret_conv;
15061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15062 LDKDecodeError e_conv;
15063 e_conv.inner = (void*)(e & (~1));
15064 e_conv.is_owned = (e & 1) || (e == 0);
15065 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15066 e_conv = DecodeError_clone(&e_conv);
15067 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15068 *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
15069 return (int64_t)ret_conv;
15072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15073 LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(o & ~1);
15074 jboolean ret_val = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
15078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15079 if ((_res & 1) != 0) return;
15080 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15081 CHECK_ACCESS(_res_ptr);
15082 LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
15084 CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
15087 static inline uintptr_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
15088 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15089 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
15090 return (int64_t)ret_conv;
15092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15093 LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(arg & ~1);
15094 int64_t ret_val = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
15098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15099 LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)(orig & ~1);
15100 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
15101 *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
15102 return (int64_t)ret_conv;
15105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15106 LDKCVec_RouteHintHopZ _res_constr;
15107 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15108 if (_res_constr.datalen > 0)
15109 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
15111 _res_constr.data = NULL;
15112 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15113 for (size_t o = 0; o < _res_constr.datalen; o++) {
15114 int64_t _res_conv_14 = _res_vals[o];
15115 LDKRouteHintHop _res_conv_14_conv;
15116 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
15117 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
15118 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
15119 _res_constr.data[o] = _res_conv_14_conv;
15121 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15122 CVec_RouteHintHopZ_free(_res_constr);
15125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15126 LDKRouteHint o_conv;
15127 o_conv.inner = (void*)(o & (~1));
15128 o_conv.is_owned = (o & 1) || (o == 0);
15129 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15130 o_conv = RouteHint_clone(&o_conv);
15131 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15132 *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
15133 return (int64_t)ret_conv;
15136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15137 LDKDecodeError e_conv;
15138 e_conv.inner = (void*)(e & (~1));
15139 e_conv.is_owned = (e & 1) || (e == 0);
15140 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15141 e_conv = DecodeError_clone(&e_conv);
15142 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15143 *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
15144 return (int64_t)ret_conv;
15147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15148 LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)(o & ~1);
15149 jboolean ret_val = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
15153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15154 if ((_res & 1) != 0) return;
15155 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15156 CHECK_ACCESS(_res_ptr);
15157 LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
15159 CResult_RouteHintDecodeErrorZ_free(_res_conv);
15162 static inline uintptr_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
15163 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15164 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
15165 return (int64_t)ret_conv;
15167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15168 LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)(arg & ~1);
15169 int64_t ret_val = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
15173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15174 LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)(orig & ~1);
15175 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
15176 *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
15177 return (int64_t)ret_conv;
15180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15181 LDKRouteHintHop o_conv;
15182 o_conv.inner = (void*)(o & (~1));
15183 o_conv.is_owned = (o & 1) || (o == 0);
15184 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15185 o_conv = RouteHintHop_clone(&o_conv);
15186 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15187 *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
15188 return (int64_t)ret_conv;
15191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15192 LDKDecodeError e_conv;
15193 e_conv.inner = (void*)(e & (~1));
15194 e_conv.is_owned = (e & 1) || (e == 0);
15195 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15196 e_conv = DecodeError_clone(&e_conv);
15197 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15198 *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
15199 return (int64_t)ret_conv;
15202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15203 LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(o & ~1);
15204 jboolean ret_val = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
15208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15209 if ((_res & 1) != 0) return;
15210 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15211 CHECK_ACCESS(_res_ptr);
15212 LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
15214 CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
15217 static inline uintptr_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
15218 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15219 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
15220 return (int64_t)ret_conv;
15222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15223 LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(arg & ~1);
15224 int64_t ret_val = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
15228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15229 LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)(orig & ~1);
15230 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
15231 *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
15232 return (int64_t)ret_conv;
15235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15236 LDKCVec_ChannelDetailsZ _res_constr;
15237 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15238 if (_res_constr.datalen > 0)
15239 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
15241 _res_constr.data = NULL;
15242 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15243 for (size_t q = 0; q < _res_constr.datalen; q++) {
15244 int64_t _res_conv_16 = _res_vals[q];
15245 LDKChannelDetails _res_conv_16_conv;
15246 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
15247 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
15248 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
15249 _res_constr.data[q] = _res_conv_16_conv;
15251 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15252 CVec_ChannelDetailsZ_free(_res_constr);
15255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15257 o_conv.inner = (void*)(o & (~1));
15258 o_conv.is_owned = (o & 1) || (o == 0);
15259 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15260 o_conv = Route_clone(&o_conv);
15261 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15262 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
15263 return (int64_t)ret_conv;
15266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15267 LDKLightningError e_conv;
15268 e_conv.inner = (void*)(e & (~1));
15269 e_conv.is_owned = (e & 1) || (e == 0);
15270 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15271 e_conv = LightningError_clone(&e_conv);
15272 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15273 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
15274 return (int64_t)ret_conv;
15277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15278 LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)(o & ~1);
15279 jboolean ret_val = CResult_RouteLightningErrorZ_is_ok(o_conv);
15283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15284 if ((_res & 1) != 0) return;
15285 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15286 CHECK_ACCESS(_res_ptr);
15287 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
15289 CResult_RouteLightningErrorZ_free(_res_conv);
15292 static inline uintptr_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
15293 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15294 *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
15295 return (int64_t)ret_conv;
15297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15298 LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
15299 int64_t ret_val = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
15303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15304 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
15305 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
15306 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
15307 return (int64_t)ret_conv;
15310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15311 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15312 CHECK_ACCESS(o_ptr);
15313 LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
15314 o_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)o) & ~1));
15315 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15316 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
15317 return (int64_t)ret_conv;
15320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
15321 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
15322 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15323 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
15324 return (int64_t)ret_conv;
15327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15328 LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)(o & ~1);
15329 jboolean ret_val = CResult_TxOutAccessErrorZ_is_ok(o_conv);
15333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15334 if ((_res & 1) != 0) return;
15335 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15336 CHECK_ACCESS(_res_ptr);
15337 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
15339 CResult_TxOutAccessErrorZ_free(_res_conv);
15342 static inline uintptr_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
15343 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15344 *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
15345 return (int64_t)ret_conv;
15347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15348 LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
15349 int64_t ret_val = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
15353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15354 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
15355 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
15356 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
15357 return (int64_t)ret_conv;
15360 static inline uintptr_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
15361 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15362 *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
15363 return ((int64_t)ret_conv);
15365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15366 LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)(arg & ~1);
15367 int64_t ret_val = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
15371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15372 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
15373 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15374 *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
15375 return ((int64_t)ret_conv);
15378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
15379 LDKTransaction b_ref;
15380 b_ref.datalen = (*env)->GetArrayLength(env, b);
15381 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
15382 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
15383 b_ref.data_is_owned = true;
15384 LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
15385 *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
15386 return ((int64_t)ret_conv);
15389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15390 if ((_res & 1) != 0) return;
15391 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15392 CHECK_ACCESS(_res_ptr);
15393 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
15395 C2Tuple_usizeTransactionZ_free(_res_conv);
15398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15399 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
15400 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15401 if (_res_constr.datalen > 0)
15402 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15404 _res_constr.data = NULL;
15405 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15406 for (size_t c = 0; c < _res_constr.datalen; c++) {
15407 int64_t _res_conv_28 = _res_vals[c];
15408 void* _res_conv_28_ptr = (void*)(((uintptr_t)_res_conv_28) & ~1);
15409 CHECK_ACCESS(_res_conv_28_ptr);
15410 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
15411 FREE((void*)_res_conv_28);
15412 _res_constr.data[c] = _res_conv_28_conv;
15414 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15415 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
15418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
15419 LDKCVec_TxidZ _res_constr;
15420 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15421 if (_res_constr.datalen > 0)
15422 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
15424 _res_constr.data = NULL;
15425 for (size_t i = 0; i < _res_constr.datalen; i++) {
15426 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
15427 LDKThirtyTwoBytes _res_conv_8_ref;
15428 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
15429 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
15430 _res_constr.data[i] = _res_conv_8_ref;
15432 CVec_TxidZ_free(_res_constr);
15435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
15436 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15437 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
15438 return (int64_t)ret_conv;
15441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
15442 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
15443 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15444 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
15445 return (int64_t)ret_conv;
15448 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15449 LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(o & ~1);
15450 jboolean ret_val = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
15454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15455 if ((_res & 1) != 0) return;
15456 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15457 CHECK_ACCESS(_res_ptr);
15458 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
15460 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
15463 static inline uintptr_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
15464 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15465 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
15466 return (int64_t)ret_conv;
15468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15469 LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
15470 int64_t ret_val = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
15474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15475 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
15476 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
15477 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
15478 return (int64_t)ret_conv;
15481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15482 LDKCVec_MonitorEventZ _res_constr;
15483 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15484 if (_res_constr.datalen > 0)
15485 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
15487 _res_constr.data = NULL;
15488 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15489 for (size_t o = 0; o < _res_constr.datalen; o++) {
15490 int64_t _res_conv_14 = _res_vals[o];
15491 void* _res_conv_14_ptr = (void*)(((uintptr_t)_res_conv_14) & ~1);
15492 CHECK_ACCESS(_res_conv_14_ptr);
15493 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
15494 FREE((void*)_res_conv_14);
15495 _res_constr.data[o] = _res_conv_14_conv;
15497 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15498 CVec_MonitorEventZ_free(_res_constr);
15501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15502 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15503 CHECK_ACCESS(o_ptr);
15504 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(o_ptr);
15505 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)o) & ~1));
15506 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15507 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
15508 int64_t ret_ref = (uintptr_t)ret_copy;
15512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
15513 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15514 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
15515 int64_t ret_ref = (uintptr_t)ret_copy;
15519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15520 if ((_res & 1) != 0) return;
15521 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15522 CHECK_ACCESS(_res_ptr);
15523 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(_res_ptr);
15525 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
15528 static inline uintptr_t COption_C2Tuple_usizeTransactionZZ_clone_ptr(LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR arg) {
15529 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15530 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(arg);
15531 int64_t ret_ref = (uintptr_t)ret_copy;
15534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15535 LDKCOption_C2Tuple_usizeTransactionZZ* arg_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)arg;
15536 int64_t ret_val = COption_C2Tuple_usizeTransactionZZ_clone_ptr(arg_conv);
15540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15541 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
15542 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
15543 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
15544 int64_t ret_ref = (uintptr_t)ret_copy;
15548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15549 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15550 CHECK_ACCESS(o_ptr);
15551 LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
15552 o_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)o) & ~1));
15553 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15554 *ret_copy = COption_ClosureReasonZ_some(o_conv);
15555 int64_t ret_ref = (uintptr_t)ret_copy;
15559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
15560 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15561 *ret_copy = COption_ClosureReasonZ_none();
15562 int64_t ret_ref = (uintptr_t)ret_copy;
15566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15567 if ((_res & 1) != 0) return;
15568 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15569 CHECK_ACCESS(_res_ptr);
15570 LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
15572 COption_ClosureReasonZ_free(_res_conv);
15575 static inline uintptr_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
15576 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15577 *ret_copy = COption_ClosureReasonZ_clone(arg);
15578 int64_t ret_ref = (uintptr_t)ret_copy;
15581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15582 LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)arg;
15583 int64_t ret_val = COption_ClosureReasonZ_clone_ptr(arg_conv);
15587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15588 LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)orig;
15589 LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
15590 *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
15591 int64_t ret_ref = (uintptr_t)ret_copy;
15595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15596 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15597 CHECK_ACCESS(o_ptr);
15598 LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
15599 o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)(((uintptr_t)o) & ~1));
15600 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15601 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
15602 return (int64_t)ret_conv;
15605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15606 LDKDecodeError e_conv;
15607 e_conv.inner = (void*)(e & (~1));
15608 e_conv.is_owned = (e & 1) || (e == 0);
15609 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15610 e_conv = DecodeError_clone(&e_conv);
15611 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15612 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
15613 return (int64_t)ret_conv;
15616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15617 LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(o & ~1);
15618 jboolean ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
15622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15623 if ((_res & 1) != 0) return;
15624 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15625 CHECK_ACCESS(_res_ptr);
15626 LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
15628 CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
15631 static inline uintptr_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
15632 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15633 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
15634 return (int64_t)ret_conv;
15636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15637 LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(arg & ~1);
15638 int64_t ret_val = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
15642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15643 LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(orig & ~1);
15644 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
15645 *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
15646 return (int64_t)ret_conv;
15649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15650 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15651 CHECK_ACCESS(o_ptr);
15652 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
15653 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uintptr_t)o) & ~1));
15654 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15655 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
15656 int64_t ret_ref = (uintptr_t)ret_copy;
15660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
15661 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15662 *ret_copy = COption_NetworkUpdateZ_none();
15663 int64_t ret_ref = (uintptr_t)ret_copy;
15667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15668 if ((_res & 1) != 0) return;
15669 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15670 CHECK_ACCESS(_res_ptr);
15671 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
15673 COption_NetworkUpdateZ_free(_res_conv);
15676 static inline uintptr_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
15677 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15678 *ret_copy = COption_NetworkUpdateZ_clone(arg);
15679 int64_t ret_ref = (uintptr_t)ret_copy;
15682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15683 LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)arg;
15684 int64_t ret_val = COption_NetworkUpdateZ_clone_ptr(arg_conv);
15688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15689 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
15690 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
15691 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
15692 int64_t ret_ref = (uintptr_t)ret_copy;
15696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15697 LDKCVec_SpendableOutputDescriptorZ _res_constr;
15698 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15699 if (_res_constr.datalen > 0)
15700 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15702 _res_constr.data = NULL;
15703 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15704 for (size_t b = 0; b < _res_constr.datalen; b++) {
15705 int64_t _res_conv_27 = _res_vals[b];
15706 void* _res_conv_27_ptr = (void*)(((uintptr_t)_res_conv_27) & ~1);
15707 CHECK_ACCESS(_res_conv_27_ptr);
15708 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
15709 FREE((void*)_res_conv_27);
15710 _res_constr.data[b] = _res_conv_27_conv;
15712 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15713 CVec_SpendableOutputDescriptorZ_free(_res_constr);
15716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
15717 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15718 CHECK_ACCESS(o_ptr);
15719 LDKEvent o_conv = *(LDKEvent*)(o_ptr);
15720 o_conv = Event_clone((LDKEvent*)(((uintptr_t)o) & ~1));
15721 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15722 *ret_copy = COption_EventZ_some(o_conv);
15723 int64_t ret_ref = (uintptr_t)ret_copy;
15727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
15728 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15729 *ret_copy = COption_EventZ_none();
15730 int64_t ret_ref = (uintptr_t)ret_copy;
15734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15735 if ((_res & 1) != 0) return;
15736 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15737 CHECK_ACCESS(_res_ptr);
15738 LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
15740 COption_EventZ_free(_res_conv);
15743 static inline uintptr_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
15744 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15745 *ret_copy = COption_EventZ_clone(arg);
15746 int64_t ret_ref = (uintptr_t)ret_copy;
15749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15750 LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)arg;
15751 int64_t ret_val = COption_EventZ_clone_ptr(arg_conv);
15755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15756 LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)orig;
15757 LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15758 *ret_copy = COption_EventZ_clone(orig_conv);
15759 int64_t ret_ref = (uintptr_t)ret_copy;
15763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15764 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
15765 CHECK_ACCESS(o_ptr);
15766 LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
15767 o_conv = COption_EventZ_clone((LDKCOption_EventZ*)(((uintptr_t)o) & ~1));
15768 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15769 *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
15770 return (int64_t)ret_conv;
15773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15774 LDKDecodeError e_conv;
15775 e_conv.inner = (void*)(e & (~1));
15776 e_conv.is_owned = (e & 1) || (e == 0);
15777 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15778 e_conv = DecodeError_clone(&e_conv);
15779 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15780 *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
15781 return (int64_t)ret_conv;
15784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15785 LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(o & ~1);
15786 jboolean ret_val = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
15790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15791 if ((_res & 1) != 0) return;
15792 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15793 CHECK_ACCESS(_res_ptr);
15794 LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
15796 CResult_COption_EventZDecodeErrorZ_free(_res_conv);
15799 static inline uintptr_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
15800 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15801 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
15802 return (int64_t)ret_conv;
15804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15805 LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(arg & ~1);
15806 int64_t ret_val = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
15810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15811 LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)(orig & ~1);
15812 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
15813 *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
15814 return (int64_t)ret_conv;
15817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
15818 LDKCVec_MessageSendEventZ _res_constr;
15819 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
15820 if (_res_constr.datalen > 0)
15821 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
15823 _res_constr.data = NULL;
15824 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
15825 for (size_t s = 0; s < _res_constr.datalen; s++) {
15826 int64_t _res_conv_18 = _res_vals[s];
15827 void* _res_conv_18_ptr = (void*)(((uintptr_t)_res_conv_18) & ~1);
15828 CHECK_ACCESS(_res_conv_18_ptr);
15829 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
15830 FREE((void*)_res_conv_18);
15831 _res_constr.data[s] = _res_conv_18_conv;
15833 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
15834 CVec_MessageSendEventZ_free(_res_constr);
15837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15838 LDKFixedPenaltyScorer o_conv;
15839 o_conv.inner = (void*)(o & (~1));
15840 o_conv.is_owned = (o & 1) || (o == 0);
15841 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15842 o_conv = FixedPenaltyScorer_clone(&o_conv);
15843 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
15844 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
15845 return (int64_t)ret_conv;
15848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15849 LDKDecodeError e_conv;
15850 e_conv.inner = (void*)(e & (~1));
15851 e_conv.is_owned = (e & 1) || (e == 0);
15852 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15853 e_conv = DecodeError_clone(&e_conv);
15854 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
15855 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
15856 return (int64_t)ret_conv;
15859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15860 LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(o & ~1);
15861 jboolean ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
15865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15866 if ((_res & 1) != 0) return;
15867 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15868 CHECK_ACCESS(_res_ptr);
15869 LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
15871 CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
15874 static inline uintptr_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
15875 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
15876 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
15877 return (int64_t)ret_conv;
15879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15880 LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(arg & ~1);
15881 int64_t ret_val = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
15885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15886 LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(orig & ~1);
15887 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
15888 *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
15889 return (int64_t)ret_conv;
15892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15893 LDKScoringParameters o_conv;
15894 o_conv.inner = (void*)(o & (~1));
15895 o_conv.is_owned = (o & 1) || (o == 0);
15896 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15897 o_conv = ScoringParameters_clone(&o_conv);
15898 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
15899 *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv);
15900 return (int64_t)ret_conv;
15903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15904 LDKDecodeError e_conv;
15905 e_conv.inner = (void*)(e & (~1));
15906 e_conv.is_owned = (e & 1) || (e == 0);
15907 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15908 e_conv = DecodeError_clone(&e_conv);
15909 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
15910 *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv);
15911 return (int64_t)ret_conv;
15914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15915 LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1);
15916 jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv);
15920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15921 if ((_res & 1) != 0) return;
15922 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15923 CHECK_ACCESS(_res_ptr);
15924 LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr);
15926 CResult_ScoringParametersDecodeErrorZ_free(_res_conv);
15929 static inline uintptr_t CResult_ScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR arg) {
15930 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
15931 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(arg);
15932 return (int64_t)ret_conv;
15934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
15935 LDKCResult_ScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1);
15936 int64_t ret_val = CResult_ScoringParametersDecodeErrorZ_clone_ptr(arg_conv);
15940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15941 LDKCResult_ScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(orig & ~1);
15942 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
15943 *ret_conv = CResult_ScoringParametersDecodeErrorZ_clone(orig_conv);
15944 return (int64_t)ret_conv;
15947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15949 o_conv.inner = (void*)(o & (~1));
15950 o_conv.is_owned = (o & 1) || (o == 0);
15951 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15952 // WARNING: we need a move here but no clone is available for LDKScorer
15953 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
15954 *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv);
15955 return (int64_t)ret_conv;
15958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15959 LDKDecodeError e_conv;
15960 e_conv.inner = (void*)(e & (~1));
15961 e_conv.is_owned = (e & 1) || (e == 0);
15962 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15963 e_conv = DecodeError_clone(&e_conv);
15964 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
15965 *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv);
15966 return (int64_t)ret_conv;
15969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
15970 LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1);
15971 jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv);
15975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
15976 if ((_res & 1) != 0) return;
15977 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
15978 CHECK_ACCESS(_res_ptr);
15979 LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr);
15981 CResult_ScorerDecodeErrorZ_free(_res_conv);
15984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
15985 LDKProbabilisticScoringParameters o_conv;
15986 o_conv.inner = (void*)(o & (~1));
15987 o_conv.is_owned = (o & 1) || (o == 0);
15988 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15989 o_conv = ProbabilisticScoringParameters_clone(&o_conv);
15990 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
15991 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o_conv);
15992 return (int64_t)ret_conv;
15995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
15996 LDKDecodeError e_conv;
15997 e_conv.inner = (void*)(e & (~1));
15998 e_conv.is_owned = (e & 1) || (e == 0);
15999 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16000 e_conv = DecodeError_clone(&e_conv);
16001 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
16002 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e_conv);
16003 return (int64_t)ret_conv;
16006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16007 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(o & ~1);
16008 jboolean ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o_conv);
16012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16013 if ((_res & 1) != 0) return;
16014 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16015 CHECK_ACCESS(_res_ptr);
16016 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(_res_ptr);
16018 CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res_conv);
16021 static inline uintptr_t CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR arg) {
16022 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
16023 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(arg);
16024 return (int64_t)ret_conv;
16026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16027 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(arg & ~1);
16028 int64_t ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(arg_conv);
16032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16033 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(orig & ~1);
16034 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
16035 *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig_conv);
16036 return (int64_t)ret_conv;
16039 static inline uintptr_t C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR arg) {
16040 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ");
16041 *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(arg);
16042 return ((int64_t)ret_conv);
16044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16045 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* arg_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg & ~1);
16046 int64_t ret_val = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(arg_conv);
16050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16051 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* orig_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(orig & ~1);
16052 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ");
16053 *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(orig_conv);
16054 return ((int64_t)ret_conv);
16057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16058 LDKProbabilisticScoringParameters a_conv;
16059 a_conv.inner = (void*)(a & (~1));
16060 a_conv.is_owned = (a & 1) || (a == 0);
16061 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
16062 a_conv = ProbabilisticScoringParameters_clone(&a_conv);
16063 LDKNetworkGraph b_conv;
16064 b_conv.inner = (void*)(b & (~1));
16065 b_conv.is_owned = false;
16066 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16067 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ");
16068 *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a_conv, &b_conv);
16069 return ((int64_t)ret_conv);
16072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16073 if ((_res & 1) != 0) return;
16074 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16075 CHECK_ACCESS(_res_ptr);
16076 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ _res_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(_res_ptr);
16078 C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(_res_conv);
16081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16082 LDKProbabilisticScorer o_conv;
16083 o_conv.inner = (void*)(o & (~1));
16084 o_conv.is_owned = (o & 1) || (o == 0);
16085 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16086 // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
16087 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16088 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
16089 return (int64_t)ret_conv;
16092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16093 LDKDecodeError e_conv;
16094 e_conv.inner = (void*)(e & (~1));
16095 e_conv.is_owned = (e & 1) || (e == 0);
16096 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16097 e_conv = DecodeError_clone(&e_conv);
16098 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
16099 *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
16100 return (int64_t)ret_conv;
16103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16104 LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)(o & ~1);
16105 jboolean ret_val = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
16109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16110 if ((_res & 1) != 0) return;
16111 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16112 CHECK_ACCESS(_res_ptr);
16113 LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
16115 CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
16118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16119 LDKInitFeatures o_conv;
16120 o_conv.inner = (void*)(o & (~1));
16121 o_conv.is_owned = (o & 1) || (o == 0);
16122 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16123 o_conv = InitFeatures_clone(&o_conv);
16124 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16125 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
16126 return (int64_t)ret_conv;
16129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16130 LDKDecodeError e_conv;
16131 e_conv.inner = (void*)(e & (~1));
16132 e_conv.is_owned = (e & 1) || (e == 0);
16133 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16134 e_conv = DecodeError_clone(&e_conv);
16135 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
16136 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
16137 return (int64_t)ret_conv;
16140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16141 LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1);
16142 jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
16146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16147 if ((_res & 1) != 0) return;
16148 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16149 CHECK_ACCESS(_res_ptr);
16150 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
16152 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
16155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16156 LDKChannelFeatures o_conv;
16157 o_conv.inner = (void*)(o & (~1));
16158 o_conv.is_owned = (o & 1) || (o == 0);
16159 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16160 o_conv = ChannelFeatures_clone(&o_conv);
16161 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16162 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
16163 return (int64_t)ret_conv;
16166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16167 LDKDecodeError e_conv;
16168 e_conv.inner = (void*)(e & (~1));
16169 e_conv.is_owned = (e & 1) || (e == 0);
16170 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16171 e_conv = DecodeError_clone(&e_conv);
16172 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
16173 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
16174 return (int64_t)ret_conv;
16177 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16178 LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(o & ~1);
16179 jboolean ret_val = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
16183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16184 if ((_res & 1) != 0) return;
16185 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16186 CHECK_ACCESS(_res_ptr);
16187 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
16189 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
16192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16193 LDKNodeFeatures o_conv;
16194 o_conv.inner = (void*)(o & (~1));
16195 o_conv.is_owned = (o & 1) || (o == 0);
16196 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16197 o_conv = NodeFeatures_clone(&o_conv);
16198 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16199 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
16200 return (int64_t)ret_conv;
16203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16204 LDKDecodeError e_conv;
16205 e_conv.inner = (void*)(e & (~1));
16206 e_conv.is_owned = (e & 1) || (e == 0);
16207 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16208 e_conv = DecodeError_clone(&e_conv);
16209 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
16210 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
16211 return (int64_t)ret_conv;
16214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16215 LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1);
16216 jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
16220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16221 if ((_res & 1) != 0) return;
16222 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16223 CHECK_ACCESS(_res_ptr);
16224 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
16226 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
16229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16230 LDKInvoiceFeatures o_conv;
16231 o_conv.inner = (void*)(o & (~1));
16232 o_conv.is_owned = (o & 1) || (o == 0);
16233 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16234 o_conv = InvoiceFeatures_clone(&o_conv);
16235 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16236 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
16237 return (int64_t)ret_conv;
16240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16241 LDKDecodeError e_conv;
16242 e_conv.inner = (void*)(e & (~1));
16243 e_conv.is_owned = (e & 1) || (e == 0);
16244 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16245 e_conv = DecodeError_clone(&e_conv);
16246 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
16247 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
16248 return (int64_t)ret_conv;
16251 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16252 LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1);
16253 jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
16257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16258 if ((_res & 1) != 0) return;
16259 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16260 CHECK_ACCESS(_res_ptr);
16261 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
16263 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
16266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16267 LDKChannelTypeFeatures o_conv;
16268 o_conv.inner = (void*)(o & (~1));
16269 o_conv.is_owned = (o & 1) || (o == 0);
16270 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16271 o_conv = ChannelTypeFeatures_clone(&o_conv);
16272 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16273 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
16274 return (int64_t)ret_conv;
16277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16278 LDKDecodeError e_conv;
16279 e_conv.inner = (void*)(e & (~1));
16280 e_conv.is_owned = (e & 1) || (e == 0);
16281 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16282 e_conv = DecodeError_clone(&e_conv);
16283 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
16284 *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
16285 return (int64_t)ret_conv;
16288 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16289 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1);
16290 jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
16294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16295 if ((_res & 1) != 0) return;
16296 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16297 CHECK_ACCESS(_res_ptr);
16298 LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
16300 CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
16303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16304 LDKDelayedPaymentOutputDescriptor o_conv;
16305 o_conv.inner = (void*)(o & (~1));
16306 o_conv.is_owned = (o & 1) || (o == 0);
16307 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16308 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
16309 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16310 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16311 return (int64_t)ret_conv;
16314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16315 LDKDecodeError e_conv;
16316 e_conv.inner = (void*)(e & (~1));
16317 e_conv.is_owned = (e & 1) || (e == 0);
16318 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16319 e_conv = DecodeError_clone(&e_conv);
16320 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16321 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16322 return (int64_t)ret_conv;
16325 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16326 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
16327 jboolean ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16332 if ((_res & 1) != 0) return;
16333 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16334 CHECK_ACCESS(_res_ptr);
16335 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16337 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16340 static inline uintptr_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16341 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16342 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16343 return (int64_t)ret_conv;
16345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16346 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
16347 int64_t ret_val = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16352 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
16353 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
16354 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16355 return (int64_t)ret_conv;
16358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16359 LDKStaticPaymentOutputDescriptor o_conv;
16360 o_conv.inner = (void*)(o & (~1));
16361 o_conv.is_owned = (o & 1) || (o == 0);
16362 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16363 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
16364 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16365 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
16366 return (int64_t)ret_conv;
16369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16370 LDKDecodeError e_conv;
16371 e_conv.inner = (void*)(e & (~1));
16372 e_conv.is_owned = (e & 1) || (e == 0);
16373 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16374 e_conv = DecodeError_clone(&e_conv);
16375 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16376 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
16377 return (int64_t)ret_conv;
16380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16381 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(o & ~1);
16382 jboolean ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16387 if ((_res & 1) != 0) return;
16388 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16389 CHECK_ACCESS(_res_ptr);
16390 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
16392 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
16395 static inline uintptr_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16396 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16397 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
16398 return (int64_t)ret_conv;
16400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16401 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
16402 int64_t ret_val = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16407 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
16408 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16409 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
16410 return (int64_t)ret_conv;
16413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16414 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16415 CHECK_ACCESS(o_ptr);
16416 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
16417 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)o) & ~1));
16418 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16419 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
16420 return (int64_t)ret_conv;
16423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16424 LDKDecodeError e_conv;
16425 e_conv.inner = (void*)(e & (~1));
16426 e_conv.is_owned = (e & 1) || (e == 0);
16427 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16428 e_conv = DecodeError_clone(&e_conv);
16429 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16430 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
16431 return (int64_t)ret_conv;
16434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16435 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(o & ~1);
16436 jboolean ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
16440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16441 if ((_res & 1) != 0) return;
16442 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16443 CHECK_ACCESS(_res_ptr);
16444 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
16446 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
16449 static inline uintptr_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
16450 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16451 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
16452 return (int64_t)ret_conv;
16454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16455 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
16456 int64_t ret_val = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
16460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16461 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
16462 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16463 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
16464 return (int64_t)ret_conv;
16467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PaymentPreimageZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16468 LDKCVec_PaymentPreimageZ _res_constr;
16469 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16470 if (_res_constr.datalen > 0)
16471 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
16473 _res_constr.data = NULL;
16474 for (size_t i = 0; i < _res_constr.datalen; i++) {
16475 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16476 LDKThirtyTwoBytes _res_conv_8_ref;
16477 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
16478 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
16479 _res_constr.data[i] = _res_conv_8_ref;
16481 CVec_PaymentPreimageZ_free(_res_constr);
16484 static inline uintptr_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
16485 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16486 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
16487 return ((int64_t)ret_conv);
16489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16490 LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(arg & ~1);
16491 int64_t ret_val = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
16495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16496 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
16497 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16498 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
16499 return ((int64_t)ret_conv);
16502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
16503 LDKSignature a_ref;
16504 CHECK((*env)->GetArrayLength(env, a) == 64);
16505 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
16506 LDKCVec_SignatureZ b_constr;
16507 b_constr.datalen = (*env)->GetArrayLength(env, b);
16508 if (b_constr.datalen > 0)
16509 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16511 b_constr.data = NULL;
16512 for (size_t i = 0; i < b_constr.datalen; i++) {
16513 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
16514 LDKSignature b_conv_8_ref;
16515 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
16516 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
16517 b_constr.data[i] = b_conv_8_ref;
16519 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16520 *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
16521 return ((int64_t)ret_conv);
16524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16525 if ((_res & 1) != 0) return;
16526 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16527 CHECK_ACCESS(_res_ptr);
16528 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
16530 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
16533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16534 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16535 CHECK_ACCESS(o_ptr);
16536 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
16537 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uintptr_t)o) & ~1));
16538 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16539 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
16540 return (int64_t)ret_conv;
16543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
16544 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16545 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
16546 return (int64_t)ret_conv;
16549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16550 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(o & ~1);
16551 jboolean ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
16555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16556 if ((_res & 1) != 0) return;
16557 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16558 CHECK_ACCESS(_res_ptr);
16559 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
16561 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
16564 static inline uintptr_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
16565 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16566 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
16567 return (int64_t)ret_conv;
16569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16570 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
16571 int64_t ret_val = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
16575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16576 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
16577 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16578 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
16579 return (int64_t)ret_conv;
16582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16583 LDKSignature o_ref;
16584 CHECK((*env)->GetArrayLength(env, o) == 64);
16585 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
16586 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16587 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
16588 return (int64_t)ret_conv;
16591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
16592 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16593 *ret_conv = CResult_SignatureNoneZ_err();
16594 return (int64_t)ret_conv;
16597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16598 LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)(o & ~1);
16599 jboolean ret_val = CResult_SignatureNoneZ_is_ok(o_conv);
16603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16604 if ((_res & 1) != 0) return;
16605 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16606 CHECK_ACCESS(_res_ptr);
16607 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
16609 CResult_SignatureNoneZ_free(_res_conv);
16612 static inline uintptr_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
16613 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16614 *ret_conv = CResult_SignatureNoneZ_clone(arg);
16615 return (int64_t)ret_conv;
16617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16618 LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)(arg & ~1);
16619 int64_t ret_val = CResult_SignatureNoneZ_clone_ptr(arg_conv);
16623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16624 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
16625 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16626 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
16627 return (int64_t)ret_conv;
16630 static inline uintptr_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
16631 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16632 *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
16633 return ((int64_t)ret_conv);
16635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16636 LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)(arg & ~1);
16637 int64_t ret_val = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
16641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16642 LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)(orig & ~1);
16643 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16644 *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
16645 return ((int64_t)ret_conv);
16648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
16649 LDKSignature a_ref;
16650 CHECK((*env)->GetArrayLength(env, a) == 64);
16651 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
16652 LDKSignature b_ref;
16653 CHECK((*env)->GetArrayLength(env, b) == 64);
16654 (*env)->GetByteArrayRegion(env, b, 0, 64, b_ref.compact_form);
16655 LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
16656 *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
16657 return ((int64_t)ret_conv);
16660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16661 if ((_res & 1) != 0) return;
16662 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16663 CHECK_ACCESS(_res_ptr);
16664 LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
16666 C2Tuple_SignatureSignatureZ_free(_res_conv);
16669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16670 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16671 CHECK_ACCESS(o_ptr);
16672 LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
16673 o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)(((uintptr_t)o) & ~1));
16674 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16675 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
16676 return (int64_t)ret_conv;
16679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
16680 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16681 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
16682 return (int64_t)ret_conv;
16685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16686 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(o & ~1);
16687 jboolean ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
16691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16692 if ((_res & 1) != 0) return;
16693 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16694 CHECK_ACCESS(_res_ptr);
16695 LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
16697 CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
16700 static inline uintptr_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
16701 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16702 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
16703 return (int64_t)ret_conv;
16705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16706 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(arg & ~1);
16707 int64_t ret_val = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
16711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureSignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16712 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(orig & ~1);
16713 LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
16714 *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
16715 return (int64_t)ret_conv;
16718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16719 LDKSecretKey o_ref;
16720 CHECK((*env)->GetArrayLength(env, o) == 32);
16721 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
16722 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
16723 *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
16724 return (int64_t)ret_conv;
16727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1err(JNIEnv *env, jclass clz) {
16728 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
16729 *ret_conv = CResult_SecretKeyNoneZ_err();
16730 return (int64_t)ret_conv;
16733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16734 LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)(o & ~1);
16735 jboolean ret_val = CResult_SecretKeyNoneZ_is_ok(o_conv);
16739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16740 if ((_res & 1) != 0) return;
16741 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16742 CHECK_ACCESS(_res_ptr);
16743 LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
16745 CResult_SecretKeyNoneZ_free(_res_conv);
16748 static inline uintptr_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
16749 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
16750 *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
16751 return (int64_t)ret_conv;
16753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16754 LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)(arg & ~1);
16755 int64_t ret_val = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
16759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16760 LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)(orig & ~1);
16761 LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
16762 *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
16763 return (int64_t)ret_conv;
16766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16767 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
16768 CHECK_ACCESS(o_ptr);
16769 LDKSign o_conv = *(LDKSign*)(o_ptr);
16770 if (o_conv.free == LDKSign_JCalls_free) {
16771 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16772 LDKSign_JCalls_cloned(&o_conv);
16774 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16775 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
16776 return (int64_t)ret_conv;
16779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16780 LDKDecodeError e_conv;
16781 e_conv.inner = (void*)(e & (~1));
16782 e_conv.is_owned = (e & 1) || (e == 0);
16783 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16784 e_conv = DecodeError_clone(&e_conv);
16785 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16786 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
16787 return (int64_t)ret_conv;
16790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16791 LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)(o & ~1);
16792 jboolean ret_val = CResult_SignDecodeErrorZ_is_ok(o_conv);
16796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16797 if ((_res & 1) != 0) return;
16798 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16799 CHECK_ACCESS(_res_ptr);
16800 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
16802 CResult_SignDecodeErrorZ_free(_res_conv);
16805 static inline uintptr_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
16806 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16807 *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
16808 return (int64_t)ret_conv;
16810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16811 LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
16812 int64_t ret_val = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
16816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16817 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
16818 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16819 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
16820 return (int64_t)ret_conv;
16823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16824 LDKCVec_u5Z _res_constr;
16825 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16826 if (_res_constr.datalen > 0)
16827 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
16829 _res_constr.data = NULL;
16830 int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
16831 for (size_t h = 0; h < _res_constr.datalen; h++) {
16832 int8_t _res_conv_7 = _res_vals[h];
16834 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
16836 (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
16837 CVec_u5Z_free(_res_constr);
16840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
16841 LDKRecoverableSignature o_ref;
16842 CHECK((*env)->GetArrayLength(env, o) == 68);
16843 (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
16844 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16845 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16846 return (int64_t)ret_conv;
16849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
16850 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16851 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16852 return (int64_t)ret_conv;
16855 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16856 LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)(o & ~1);
16857 jboolean ret_val = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16862 if ((_res & 1) != 0) return;
16863 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16864 CHECK_ACCESS(_res_ptr);
16865 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16867 CResult_RecoverableSignatureNoneZ_free(_res_conv);
16870 static inline uintptr_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16871 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16872 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16873 return (int64_t)ret_conv;
16875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16876 LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
16877 int64_t ret_val = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16882 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
16883 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16884 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16885 return (int64_t)ret_conv;
16888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
16889 LDKCVec_u8Z _res_ref;
16890 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
16891 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
16892 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
16893 CVec_u8Z_free(_res_ref);
16896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
16897 LDKCVec_CVec_u8ZZ _res_constr;
16898 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
16899 if (_res_constr.datalen > 0)
16900 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16902 _res_constr.data = NULL;
16903 for (size_t i = 0; i < _res_constr.datalen; i++) {
16904 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
16905 LDKCVec_u8Z _res_conv_8_ref;
16906 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
16907 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
16908 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
16909 _res_constr.data[i] = _res_conv_8_ref;
16911 CVec_CVec_u8ZZ_free(_res_constr);
16914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
16915 LDKCVec_CVec_u8ZZ o_constr;
16916 o_constr.datalen = (*env)->GetArrayLength(env, o);
16917 if (o_constr.datalen > 0)
16918 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16920 o_constr.data = NULL;
16921 for (size_t i = 0; i < o_constr.datalen; i++) {
16922 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
16923 LDKCVec_u8Z o_conv_8_ref;
16924 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
16925 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
16926 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
16927 o_constr.data[i] = o_conv_8_ref;
16929 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16930 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16931 return (int64_t)ret_conv;
16934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
16935 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16936 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16937 return (int64_t)ret_conv;
16940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16941 LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(o & ~1);
16942 jboolean ret_val = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
16947 if ((_res & 1) != 0) return;
16948 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
16949 CHECK_ACCESS(_res_ptr);
16950 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16952 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16955 static inline uintptr_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16956 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16957 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16958 return (int64_t)ret_conv;
16960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
16961 LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
16962 int64_t ret_val = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16967 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
16968 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16969 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16970 return (int64_t)ret_conv;
16973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
16974 LDKInMemorySigner o_conv;
16975 o_conv.inner = (void*)(o & (~1));
16976 o_conv.is_owned = (o & 1) || (o == 0);
16977 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16978 o_conv = InMemorySigner_clone(&o_conv);
16979 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16980 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16981 return (int64_t)ret_conv;
16984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
16985 LDKDecodeError e_conv;
16986 e_conv.inner = (void*)(e & (~1));
16987 e_conv.is_owned = (e & 1) || (e == 0);
16988 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16989 e_conv = DecodeError_clone(&e_conv);
16990 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16991 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16992 return (int64_t)ret_conv;
16995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
16996 LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(o & ~1);
16997 jboolean ret_val = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
17001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17002 if ((_res & 1) != 0) return;
17003 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17004 CHECK_ACCESS(_res_ptr);
17005 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
17007 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
17010 static inline uintptr_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
17011 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17012 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
17013 return (int64_t)ret_conv;
17015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17016 LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
17017 int64_t ret_val = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
17021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17022 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
17023 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17024 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
17025 return (int64_t)ret_conv;
17028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17029 LDKCVec_TxOutZ _res_constr;
17030 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17031 if (_res_constr.datalen > 0)
17032 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17034 _res_constr.data = NULL;
17035 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17036 for (size_t h = 0; h < _res_constr.datalen; h++) {
17037 int64_t _res_conv_7 = _res_vals[h];
17038 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
17039 CHECK_ACCESS(_res_conv_7_ptr);
17040 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
17041 FREE((void*)_res_conv_7);
17042 _res_constr.data[h] = _res_conv_7_conv;
17044 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17045 CVec_TxOutZ_free(_res_constr);
17048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17049 LDKTransaction o_ref;
17050 o_ref.datalen = (*env)->GetArrayLength(env, o);
17051 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
17052 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
17053 o_ref.data_is_owned = true;
17054 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17055 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
17056 return (int64_t)ret_conv;
17059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
17060 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17061 *ret_conv = CResult_TransactionNoneZ_err();
17062 return (int64_t)ret_conv;
17065 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17066 LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)(o & ~1);
17067 jboolean ret_val = CResult_TransactionNoneZ_is_ok(o_conv);
17071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17072 if ((_res & 1) != 0) return;
17073 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17074 CHECK_ACCESS(_res_ptr);
17075 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
17077 CResult_TransactionNoneZ_free(_res_conv);
17080 static inline uintptr_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
17081 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17082 *ret_conv = CResult_TransactionNoneZ_clone(arg);
17083 return (int64_t)ret_conv;
17085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17086 LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)(arg & ~1);
17087 int64_t ret_val = CResult_TransactionNoneZ_clone_ptr(arg_conv);
17091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17092 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
17093 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17094 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
17095 return (int64_t)ret_conv;
17098 static inline uintptr_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
17099 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17100 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
17101 return ((int64_t)ret_conv);
17103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17104 LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(arg & ~1);
17105 int64_t ret_val = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
17109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17110 LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)(orig & ~1);
17111 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17112 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
17113 return ((int64_t)ret_conv);
17116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
17117 LDKThirtyTwoBytes a_ref;
17118 CHECK((*env)->GetArrayLength(env, a) == 32);
17119 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17120 LDKChannelMonitor b_conv;
17121 b_conv.inner = (void*)(b & (~1));
17122 b_conv.is_owned = (b & 1) || (b == 0);
17123 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17124 b_conv = ChannelMonitor_clone(&b_conv);
17125 LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
17126 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
17127 return ((int64_t)ret_conv);
17130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17131 if ((_res & 1) != 0) return;
17132 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17133 CHECK_ACCESS(_res_ptr);
17134 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
17136 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
17139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17140 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
17141 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17142 if (_res_constr.datalen > 0)
17143 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
17145 _res_constr.data = NULL;
17146 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17147 for (size_t j = 0; j < _res_constr.datalen; j++) {
17148 int64_t _res_conv_35 = _res_vals[j];
17149 void* _res_conv_35_ptr = (void*)(((uintptr_t)_res_conv_35) & ~1);
17150 CHECK_ACCESS(_res_conv_35_ptr);
17151 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_conv_35_ptr);
17152 FREE((void*)_res_conv_35);
17153 _res_constr.data[j] = _res_conv_35_conv;
17155 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17156 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
17159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
17160 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
17161 o_constr.datalen = (*env)->GetArrayLength(env, o);
17162 if (o_constr.datalen > 0)
17163 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
17165 o_constr.data = NULL;
17166 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
17167 for (size_t j = 0; j < o_constr.datalen; j++) {
17168 int64_t o_conv_35 = o_vals[j];
17169 void* o_conv_35_ptr = (void*)(((uintptr_t)o_conv_35) & ~1);
17170 CHECK_ACCESS(o_conv_35_ptr);
17171 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_35_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_conv_35_ptr);
17172 o_conv_35_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o_conv_35) & ~1));
17173 o_constr.data[j] = o_conv_35_conv;
17175 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
17176 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17177 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
17178 return (int64_t)ret_conv;
17181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
17182 LDKIOError e_conv = LDKIOError_from_java(env, e);
17183 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17184 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
17185 return (int64_t)ret_conv;
17188 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17189 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(o & ~1);
17190 jboolean ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(o_conv);
17194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17195 if ((_res & 1) != 0) return;
17196 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17197 CHECK_ACCESS(_res_ptr);
17198 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(_res_ptr);
17200 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
17203 static inline uintptr_t CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR arg) {
17204 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17205 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(arg);
17206 return (int64_t)ret_conv;
17208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17209 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
17210 int64_t ret_val = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(arg_conv);
17214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17215 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(orig & ~1);
17216 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
17217 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig_conv);
17218 return (int64_t)ret_conv;
17221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
17222 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17223 *ret_copy = COption_u16Z_some(o);
17224 int64_t ret_ref = (uintptr_t)ret_copy;
17228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
17229 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17230 *ret_copy = COption_u16Z_none();
17231 int64_t ret_ref = (uintptr_t)ret_copy;
17235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
17236 if ((_res & 1) != 0) return;
17237 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17238 CHECK_ACCESS(_res_ptr);
17239 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
17241 COption_u16Z_free(_res_conv);
17244 static inline uintptr_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
17245 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17246 *ret_copy = COption_u16Z_clone(arg);
17247 int64_t ret_ref = (uintptr_t)ret_copy;
17250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17251 LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)arg;
17252 int64_t ret_val = COption_u16Z_clone_ptr(arg_conv);
17256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17257 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
17258 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
17259 *ret_copy = COption_u16Z_clone(orig_conv);
17260 int64_t ret_ref = (uintptr_t)ret_copy;
17264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
17265 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17266 *ret_conv = CResult_NoneAPIErrorZ_ok();
17267 return (int64_t)ret_conv;
17270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17271 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17272 CHECK_ACCESS(e_ptr);
17273 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17274 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17275 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17276 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
17277 return (int64_t)ret_conv;
17280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17281 LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)(o & ~1);
17282 jboolean ret_val = CResult_NoneAPIErrorZ_is_ok(o_conv);
17286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17287 if ((_res & 1) != 0) return;
17288 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17289 CHECK_ACCESS(_res_ptr);
17290 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
17292 CResult_NoneAPIErrorZ_free(_res_conv);
17295 static inline uintptr_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
17296 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17297 *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
17298 return (int64_t)ret_conv;
17300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17301 LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
17302 int64_t ret_val = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
17306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17307 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
17308 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17309 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
17310 return (int64_t)ret_conv;
17313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17314 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
17315 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17316 if (_res_constr.datalen > 0)
17317 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17319 _res_constr.data = NULL;
17320 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17321 for (size_t w = 0; w < _res_constr.datalen; w++) {
17322 int64_t _res_conv_22 = _res_vals[w];
17323 void* _res_conv_22_ptr = (void*)(((uintptr_t)_res_conv_22) & ~1);
17324 CHECK_ACCESS(_res_conv_22_ptr);
17325 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
17326 FREE((void*)_res_conv_22);
17327 _res_constr.data[w] = _res_conv_22_conv;
17329 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17330 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
17333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17334 LDKCVec_APIErrorZ _res_constr;
17335 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17336 if (_res_constr.datalen > 0)
17337 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
17339 _res_constr.data = NULL;
17340 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17341 for (size_t k = 0; k < _res_constr.datalen; k++) {
17342 int64_t _res_conv_10 = _res_vals[k];
17343 void* _res_conv_10_ptr = (void*)(((uintptr_t)_res_conv_10) & ~1);
17344 CHECK_ACCESS(_res_conv_10_ptr);
17345 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
17346 FREE((void*)_res_conv_10);
17347 _res_constr.data[k] = _res_conv_10_conv;
17349 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17350 CVec_APIErrorZ_free(_res_constr);
17353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17354 LDKThirtyTwoBytes o_ref;
17355 CHECK((*env)->GetArrayLength(env, o) == 32);
17356 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17357 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17358 *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
17359 return (int64_t)ret_conv;
17362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17363 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17364 CHECK_ACCESS(e_ptr);
17365 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17366 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17367 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17368 *ret_conv = CResult__u832APIErrorZ_err(e_conv);
17369 return (int64_t)ret_conv;
17372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17373 LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)(o & ~1);
17374 jboolean ret_val = CResult__u832APIErrorZ_is_ok(o_conv);
17378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17379 if ((_res & 1) != 0) return;
17380 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17381 CHECK_ACCESS(_res_ptr);
17382 LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
17384 CResult__u832APIErrorZ_free(_res_conv);
17387 static inline uintptr_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
17388 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17389 *ret_conv = CResult__u832APIErrorZ_clone(arg);
17390 return (int64_t)ret_conv;
17392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17393 LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)(arg & ~1);
17394 int64_t ret_val = CResult__u832APIErrorZ_clone_ptr(arg_conv);
17398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17399 LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1);
17400 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
17401 *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
17402 return (int64_t)ret_conv;
17405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17406 LDKThirtyTwoBytes o_ref;
17407 CHECK((*env)->GetArrayLength(env, o) == 32);
17408 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17409 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17410 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
17411 return (int64_t)ret_conv;
17414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17415 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17416 CHECK_ACCESS(e_ptr);
17417 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17418 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17419 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17420 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
17421 return (int64_t)ret_conv;
17424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17425 LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(o & ~1);
17426 jboolean ret_val = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
17430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17431 if ((_res & 1) != 0) return;
17432 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17433 CHECK_ACCESS(_res_ptr);
17434 LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
17436 CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
17439 static inline uintptr_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
17440 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17441 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
17442 return (int64_t)ret_conv;
17444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17445 LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1);
17446 int64_t ret_val = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
17450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17451 LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1);
17452 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
17453 *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
17454 return (int64_t)ret_conv;
17457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
17458 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17459 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
17460 return (int64_t)ret_conv;
17463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17464 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17465 CHECK_ACCESS(e_ptr);
17466 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17467 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17468 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17469 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
17470 return (int64_t)ret_conv;
17473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17474 LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)(o & ~1);
17475 jboolean ret_val = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
17479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17480 if ((_res & 1) != 0) return;
17481 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17482 CHECK_ACCESS(_res_ptr);
17483 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
17485 CResult_NonePaymentSendFailureZ_free(_res_conv);
17488 static inline uintptr_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
17489 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17490 *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
17491 return (int64_t)ret_conv;
17493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17494 LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
17495 int64_t ret_val = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
17499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17500 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
17501 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17502 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
17503 return (int64_t)ret_conv;
17506 static inline uintptr_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
17507 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17508 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
17509 return ((int64_t)ret_conv);
17511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17512 LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(arg & ~1);
17513 int64_t ret_val = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
17517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17518 LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1);
17519 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17520 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
17521 return ((int64_t)ret_conv);
17524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17525 LDKThirtyTwoBytes a_ref;
17526 CHECK((*env)->GetArrayLength(env, a) == 32);
17527 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17528 LDKThirtyTwoBytes b_ref;
17529 CHECK((*env)->GetArrayLength(env, b) == 32);
17530 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
17531 LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
17532 *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
17533 return ((int64_t)ret_conv);
17536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17537 if ((_res & 1) != 0) return;
17538 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17539 CHECK_ACCESS(_res_ptr);
17540 LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
17542 C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
17545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17546 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17547 CHECK_ACCESS(o_ptr);
17548 LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
17549 o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uintptr_t)o) & ~1));
17550 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17551 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
17552 return (int64_t)ret_conv;
17555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17556 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17557 CHECK_ACCESS(e_ptr);
17558 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
17559 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)e) & ~1));
17560 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17561 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
17562 return (int64_t)ret_conv;
17565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17566 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(o & ~1);
17567 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
17571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17572 if ((_res & 1) != 0) return;
17573 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17574 CHECK_ACCESS(_res_ptr);
17575 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
17577 CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
17580 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
17581 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17582 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
17583 return (int64_t)ret_conv;
17585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17586 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1);
17587 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
17591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17592 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1);
17593 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
17594 *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
17595 return (int64_t)ret_conv;
17598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
17599 LDKCVec_NetAddressZ _res_constr;
17600 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
17601 if (_res_constr.datalen > 0)
17602 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17604 _res_constr.data = NULL;
17605 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
17606 for (size_t m = 0; m < _res_constr.datalen; m++) {
17607 int64_t _res_conv_12 = _res_vals[m];
17608 void* _res_conv_12_ptr = (void*)(((uintptr_t)_res_conv_12) & ~1);
17609 CHECK_ACCESS(_res_conv_12_ptr);
17610 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
17611 FREE((void*)_res_conv_12);
17612 _res_constr.data[m] = _res_conv_12_conv;
17614 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
17615 CVec_NetAddressZ_free(_res_constr);
17618 static inline uintptr_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
17619 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17620 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
17621 return ((int64_t)ret_conv);
17623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17624 LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(arg & ~1);
17625 int64_t ret_val = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
17629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17630 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
17631 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17632 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
17633 return ((int64_t)ret_conv);
17636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
17637 LDKThirtyTwoBytes a_ref;
17638 CHECK((*env)->GetArrayLength(env, a) == 32);
17639 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
17640 LDKThirtyTwoBytes b_ref;
17641 CHECK((*env)->GetArrayLength(env, b) == 32);
17642 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
17643 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17644 *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
17645 return ((int64_t)ret_conv);
17648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17649 if ((_res & 1) != 0) return;
17650 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17651 CHECK_ACCESS(_res_ptr);
17652 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
17654 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
17657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17658 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17659 CHECK_ACCESS(o_ptr);
17660 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17661 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
17662 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17663 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
17664 return (int64_t)ret_conv;
17667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) {
17668 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17669 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
17670 return (int64_t)ret_conv;
17673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17674 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1);
17675 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
17679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17680 if ((_res & 1) != 0) return;
17681 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17682 CHECK_ACCESS(_res_ptr);
17683 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
17685 CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
17688 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
17689 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17690 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
17691 return (int64_t)ret_conv;
17693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17694 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1);
17695 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
17699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17700 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1);
17701 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
17702 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
17703 return (int64_t)ret_conv;
17706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17707 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
17708 CHECK_ACCESS(o_ptr);
17709 LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
17710 o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uintptr_t)o) & ~1));
17711 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17712 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
17713 return (int64_t)ret_conv;
17716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17717 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17718 CHECK_ACCESS(e_ptr);
17719 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17720 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17721 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17722 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
17723 return (int64_t)ret_conv;
17726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17727 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1);
17728 jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
17732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17733 if ((_res & 1) != 0) return;
17734 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17735 CHECK_ACCESS(_res_ptr);
17736 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
17738 CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
17741 static inline uintptr_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
17742 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17743 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
17744 return (int64_t)ret_conv;
17746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17747 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1);
17748 int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
17752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17753 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1);
17754 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
17755 *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
17756 return (int64_t)ret_conv;
17759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17760 LDKThirtyTwoBytes o_ref;
17761 CHECK((*env)->GetArrayLength(env, o) == 32);
17762 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17763 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17764 *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
17765 return (int64_t)ret_conv;
17768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) {
17769 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17770 *ret_conv = CResult_PaymentSecretNoneZ_err();
17771 return (int64_t)ret_conv;
17774 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17775 LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1);
17776 jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv);
17780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17781 if ((_res & 1) != 0) return;
17782 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17783 CHECK_ACCESS(_res_ptr);
17784 LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
17786 CResult_PaymentSecretNoneZ_free(_res_conv);
17789 static inline uintptr_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
17790 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17791 *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
17792 return (int64_t)ret_conv;
17794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17795 LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1);
17796 int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
17800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17801 LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1);
17802 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
17803 *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
17804 return (int64_t)ret_conv;
17807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17808 LDKThirtyTwoBytes o_ref;
17809 CHECK((*env)->GetArrayLength(env, o) == 32);
17810 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17811 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17812 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
17813 return (int64_t)ret_conv;
17816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17817 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17818 CHECK_ACCESS(e_ptr);
17819 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17820 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17821 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17822 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
17823 return (int64_t)ret_conv;
17826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17827 LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(o & ~1);
17828 jboolean ret_val = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
17832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17833 if ((_res & 1) != 0) return;
17834 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17835 CHECK_ACCESS(_res_ptr);
17836 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
17838 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
17841 static inline uintptr_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
17842 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17843 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
17844 return (int64_t)ret_conv;
17846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17847 LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
17848 int64_t ret_val = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
17852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17853 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
17854 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17855 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
17856 return (int64_t)ret_conv;
17859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
17860 LDKThirtyTwoBytes o_ref;
17861 CHECK((*env)->GetArrayLength(env, o) == 32);
17862 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
17863 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17864 *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
17865 return (int64_t)ret_conv;
17868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17869 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
17870 CHECK_ACCESS(e_ptr);
17871 LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17872 e_conv = APIError_clone((LDKAPIError*)(((uintptr_t)e) & ~1));
17873 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17874 *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
17875 return (int64_t)ret_conv;
17878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17879 LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1);
17880 jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
17884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17885 if ((_res & 1) != 0) return;
17886 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17887 CHECK_ACCESS(_res_ptr);
17888 LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
17890 CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
17893 static inline uintptr_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
17894 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17895 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
17896 return (int64_t)ret_conv;
17898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17899 LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1);
17900 int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
17904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17905 LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1);
17906 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17907 *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
17908 return (int64_t)ret_conv;
17911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17912 LDKCounterpartyForwardingInfo o_conv;
17913 o_conv.inner = (void*)(o & (~1));
17914 o_conv.is_owned = (o & 1) || (o == 0);
17915 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17916 o_conv = CounterpartyForwardingInfo_clone(&o_conv);
17917 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17918 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
17919 return (int64_t)ret_conv;
17922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17923 LDKDecodeError e_conv;
17924 e_conv.inner = (void*)(e & (~1));
17925 e_conv.is_owned = (e & 1) || (e == 0);
17926 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17927 e_conv = DecodeError_clone(&e_conv);
17928 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17929 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
17930 return (int64_t)ret_conv;
17933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17934 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(o & ~1);
17935 jboolean ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
17939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17940 if ((_res & 1) != 0) return;
17941 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17942 CHECK_ACCESS(_res_ptr);
17943 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
17945 CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
17948 static inline uintptr_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
17949 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17950 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
17951 return (int64_t)ret_conv;
17953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
17954 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(arg & ~1);
17955 int64_t ret_val = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
17959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17960 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(orig & ~1);
17961 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17962 *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
17963 return (int64_t)ret_conv;
17966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
17967 LDKChannelCounterparty o_conv;
17968 o_conv.inner = (void*)(o & (~1));
17969 o_conv.is_owned = (o & 1) || (o == 0);
17970 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17971 o_conv = ChannelCounterparty_clone(&o_conv);
17972 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17973 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
17974 return (int64_t)ret_conv;
17977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
17978 LDKDecodeError e_conv;
17979 e_conv.inner = (void*)(e & (~1));
17980 e_conv.is_owned = (e & 1) || (e == 0);
17981 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17982 e_conv = DecodeError_clone(&e_conv);
17983 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17984 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
17985 return (int64_t)ret_conv;
17988 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
17989 LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(o & ~1);
17990 jboolean ret_val = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
17994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
17995 if ((_res & 1) != 0) return;
17996 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
17997 CHECK_ACCESS(_res_ptr);
17998 LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
18000 CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
18003 static inline uintptr_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
18004 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18005 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
18006 return (int64_t)ret_conv;
18008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18009 LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(arg & ~1);
18010 int64_t ret_val = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
18014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18015 LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)(orig & ~1);
18016 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
18017 *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
18018 return (int64_t)ret_conv;
18021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18022 LDKChannelDetails o_conv;
18023 o_conv.inner = (void*)(o & (~1));
18024 o_conv.is_owned = (o & 1) || (o == 0);
18025 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18026 o_conv = ChannelDetails_clone(&o_conv);
18027 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18028 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
18029 return (int64_t)ret_conv;
18032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18033 LDKDecodeError e_conv;
18034 e_conv.inner = (void*)(e & (~1));
18035 e_conv.is_owned = (e & 1) || (e == 0);
18036 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18037 e_conv = DecodeError_clone(&e_conv);
18038 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18039 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
18040 return (int64_t)ret_conv;
18043 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18044 LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(o & ~1);
18045 jboolean ret_val = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
18049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18050 if ((_res & 1) != 0) return;
18051 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18052 CHECK_ACCESS(_res_ptr);
18053 LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
18055 CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
18058 static inline uintptr_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
18059 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18060 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
18061 return (int64_t)ret_conv;
18063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18064 LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(arg & ~1);
18065 int64_t ret_val = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
18069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18070 LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)(orig & ~1);
18071 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
18072 *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
18073 return (int64_t)ret_conv;
18076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18077 LDKPhantomRouteHints o_conv;
18078 o_conv.inner = (void*)(o & (~1));
18079 o_conv.is_owned = (o & 1) || (o == 0);
18080 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18081 o_conv = PhantomRouteHints_clone(&o_conv);
18082 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18083 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
18084 return (int64_t)ret_conv;
18087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18088 LDKDecodeError e_conv;
18089 e_conv.inner = (void*)(e & (~1));
18090 e_conv.is_owned = (e & 1) || (e == 0);
18091 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18092 e_conv = DecodeError_clone(&e_conv);
18093 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18094 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
18095 return (int64_t)ret_conv;
18098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18099 LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(o & ~1);
18100 jboolean ret_val = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
18104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18105 if ((_res & 1) != 0) return;
18106 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18107 CHECK_ACCESS(_res_ptr);
18108 LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
18110 CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
18113 static inline uintptr_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
18114 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18115 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
18116 return (int64_t)ret_conv;
18118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18119 LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(arg & ~1);
18120 int64_t ret_val = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
18124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18125 LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)(orig & ~1);
18126 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
18127 *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
18128 return (int64_t)ret_conv;
18131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18132 LDKCVec_ChannelMonitorZ _res_constr;
18133 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18134 if (_res_constr.datalen > 0)
18135 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
18137 _res_constr.data = NULL;
18138 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18139 for (size_t q = 0; q < _res_constr.datalen; q++) {
18140 int64_t _res_conv_16 = _res_vals[q];
18141 LDKChannelMonitor _res_conv_16_conv;
18142 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
18143 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
18144 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18145 _res_constr.data[q] = _res_conv_16_conv;
18147 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18148 CVec_ChannelMonitorZ_free(_res_constr);
18151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
18152 LDKThirtyTwoBytes a_ref;
18153 CHECK((*env)->GetArrayLength(env, a) == 32);
18154 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
18155 LDKChannelManager b_conv;
18156 b_conv.inner = (void*)(b & (~1));
18157 b_conv.is_owned = (b & 1) || (b == 0);
18158 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18159 // WARNING: we need a move here but no clone is available for LDKChannelManager
18160 LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
18161 *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
18162 return ((int64_t)ret_conv);
18165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18166 if ((_res & 1) != 0) return;
18167 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18168 CHECK_ACCESS(_res_ptr);
18169 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
18171 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
18174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18175 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18176 CHECK_ACCESS(o_ptr);
18177 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
18178 // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
18179 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18180 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
18181 return (int64_t)ret_conv;
18184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18185 LDKDecodeError e_conv;
18186 e_conv.inner = (void*)(e & (~1));
18187 e_conv.is_owned = (e & 1) || (e == 0);
18188 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18189 e_conv = DecodeError_clone(&e_conv);
18190 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
18191 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
18192 return (int64_t)ret_conv;
18195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18196 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(o & ~1);
18197 jboolean ret_val = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
18201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18202 if ((_res & 1) != 0) return;
18203 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18204 CHECK_ACCESS(_res_ptr);
18205 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
18207 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
18210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18211 LDKChannelConfig o_conv;
18212 o_conv.inner = (void*)(o & (~1));
18213 o_conv.is_owned = (o & 1) || (o == 0);
18214 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18215 o_conv = ChannelConfig_clone(&o_conv);
18216 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18217 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
18218 return (int64_t)ret_conv;
18221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18222 LDKDecodeError e_conv;
18223 e_conv.inner = (void*)(e & (~1));
18224 e_conv.is_owned = (e & 1) || (e == 0);
18225 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18226 e_conv = DecodeError_clone(&e_conv);
18227 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18228 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
18229 return (int64_t)ret_conv;
18232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18233 LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(o & ~1);
18234 jboolean ret_val = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
18238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18239 if ((_res & 1) != 0) return;
18240 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18241 CHECK_ACCESS(_res_ptr);
18242 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
18244 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
18247 static inline uintptr_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
18248 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18249 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
18250 return (int64_t)ret_conv;
18252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18253 LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
18254 int64_t ret_val = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
18258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18259 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
18260 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
18261 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
18262 return (int64_t)ret_conv;
18265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18266 LDKOutPoint o_conv;
18267 o_conv.inner = (void*)(o & (~1));
18268 o_conv.is_owned = (o & 1) || (o == 0);
18269 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18270 o_conv = OutPoint_clone(&o_conv);
18271 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18272 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
18273 return (int64_t)ret_conv;
18276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18277 LDKDecodeError e_conv;
18278 e_conv.inner = (void*)(e & (~1));
18279 e_conv.is_owned = (e & 1) || (e == 0);
18280 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18281 e_conv = DecodeError_clone(&e_conv);
18282 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18283 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
18284 return (int64_t)ret_conv;
18287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18288 LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)(o & ~1);
18289 jboolean ret_val = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
18293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18294 if ((_res & 1) != 0) return;
18295 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18296 CHECK_ACCESS(_res_ptr);
18297 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
18299 CResult_OutPointDecodeErrorZ_free(_res_conv);
18302 static inline uintptr_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
18303 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18304 *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
18305 return (int64_t)ret_conv;
18307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18308 LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
18309 int64_t ret_val = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
18313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18314 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
18315 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
18316 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
18317 return (int64_t)ret_conv;
18320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
18321 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18322 CHECK_ACCESS(o_ptr);
18323 LDKType o_conv = *(LDKType*)(o_ptr);
18324 if (o_conv.free == LDKType_JCalls_free) {
18325 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18326 LDKType_JCalls_cloned(&o_conv);
18328 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18329 *ret_copy = COption_TypeZ_some(o_conv);
18330 int64_t ret_ref = (uintptr_t)ret_copy;
18334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
18335 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18336 *ret_copy = COption_TypeZ_none();
18337 int64_t ret_ref = (uintptr_t)ret_copy;
18341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18342 if ((_res & 1) != 0) return;
18343 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18344 CHECK_ACCESS(_res_ptr);
18345 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
18347 COption_TypeZ_free(_res_conv);
18350 static inline uintptr_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
18351 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18352 *ret_copy = COption_TypeZ_clone(arg);
18353 int64_t ret_ref = (uintptr_t)ret_copy;
18356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18357 LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)arg;
18358 int64_t ret_val = COption_TypeZ_clone_ptr(arg_conv);
18362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18363 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
18364 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
18365 *ret_copy = COption_TypeZ_clone(orig_conv);
18366 int64_t ret_ref = (uintptr_t)ret_copy;
18370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18371 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
18372 CHECK_ACCESS(o_ptr);
18373 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
18374 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uintptr_t)o) & ~1));
18375 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18376 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
18377 return (int64_t)ret_conv;
18380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18381 LDKDecodeError e_conv;
18382 e_conv.inner = (void*)(e & (~1));
18383 e_conv.is_owned = (e & 1) || (e == 0);
18384 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18385 e_conv = DecodeError_clone(&e_conv);
18386 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18387 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
18388 return (int64_t)ret_conv;
18391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18392 LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(o & ~1);
18393 jboolean ret_val = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
18397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18398 if ((_res & 1) != 0) return;
18399 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18400 CHECK_ACCESS(_res_ptr);
18401 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
18403 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
18406 static inline uintptr_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
18407 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18408 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
18409 return (int64_t)ret_conv;
18411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18412 LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
18413 int64_t ret_val = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
18417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18418 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
18419 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
18420 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
18421 return (int64_t)ret_conv;
18424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
18425 LDKThirtyTwoBytes o_ref;
18426 CHECK((*env)->GetArrayLength(env, o) == 32);
18427 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
18428 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18429 *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
18430 return (int64_t)ret_conv;
18433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
18434 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
18435 CHECK_ACCESS(e_ptr);
18436 LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
18437 e_conv = PaymentError_clone((LDKPaymentError*)(((uintptr_t)e) & ~1));
18438 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18439 *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
18440 return (int64_t)ret_conv;
18443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18444 LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(o & ~1);
18445 jboolean ret_val = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
18449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18450 if ((_res & 1) != 0) return;
18451 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18452 CHECK_ACCESS(_res_ptr);
18453 LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
18455 CResult_PaymentIdPaymentErrorZ_free(_res_conv);
18458 static inline uintptr_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
18459 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18460 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
18461 return (int64_t)ret_conv;
18463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18464 LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(arg & ~1);
18465 int64_t ret_val = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
18469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18470 LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)(orig & ~1);
18471 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
18472 *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
18473 return (int64_t)ret_conv;
18476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
18477 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
18478 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
18479 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
18480 return (int64_t)ret_conv;
18483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
18484 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
18485 *ret_conv = CResult_SiPrefixNoneZ_err();
18486 return (int64_t)ret_conv;
18489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18490 LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1);
18491 jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv);
18495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18496 if ((_res & 1) != 0) return;
18497 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18498 CHECK_ACCESS(_res_ptr);
18499 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr);
18501 CResult_SiPrefixNoneZ_free(_res_conv);
18504 static inline uintptr_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) {
18505 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
18506 *ret_conv = CResult_SiPrefixNoneZ_clone(arg);
18507 return (int64_t)ret_conv;
18509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18510 LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
18511 int64_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv);
18515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18516 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
18517 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
18518 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
18519 return (int64_t)ret_conv;
18522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18524 o_conv.inner = (void*)(o & (~1));
18525 o_conv.is_owned = (o & 1) || (o == 0);
18526 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18527 o_conv = Invoice_clone(&o_conv);
18528 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
18529 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
18530 return (int64_t)ret_conv;
18533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
18534 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
18535 *ret_conv = CResult_InvoiceNoneZ_err();
18536 return (int64_t)ret_conv;
18539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18540 LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1);
18541 jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv);
18545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18546 if ((_res & 1) != 0) return;
18547 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18548 CHECK_ACCESS(_res_ptr);
18549 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr);
18551 CResult_InvoiceNoneZ_free(_res_conv);
18554 static inline uintptr_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) {
18555 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
18556 *ret_conv = CResult_InvoiceNoneZ_clone(arg);
18557 return (int64_t)ret_conv;
18559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18560 LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
18561 int64_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv);
18565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18566 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
18567 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
18568 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
18569 return (int64_t)ret_conv;
18572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18573 LDKSignedRawInvoice o_conv;
18574 o_conv.inner = (void*)(o & (~1));
18575 o_conv.is_owned = (o & 1) || (o == 0);
18576 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18577 o_conv = SignedRawInvoice_clone(&o_conv);
18578 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
18579 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
18580 return (int64_t)ret_conv;
18583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
18584 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
18585 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
18586 return (int64_t)ret_conv;
18589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18590 LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1);
18591 jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv);
18595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18596 if ((_res & 1) != 0) return;
18597 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18598 CHECK_ACCESS(_res_ptr);
18599 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr);
18601 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
18604 static inline uintptr_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) {
18605 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
18606 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg);
18607 return (int64_t)ret_conv;
18609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18610 LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
18611 int64_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv);
18615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18616 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
18617 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
18618 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
18619 return (int64_t)ret_conv;
18622 static inline uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
18623 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18624 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
18625 return ((int64_t)ret_conv);
18627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18628 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(arg & ~1);
18629 int64_t ret_val = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
18633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18634 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
18635 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18636 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
18637 return ((int64_t)ret_conv);
18640 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) {
18641 LDKRawInvoice a_conv;
18642 a_conv.inner = (void*)(a & (~1));
18643 a_conv.is_owned = (a & 1) || (a == 0);
18644 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
18645 a_conv = RawInvoice_clone(&a_conv);
18646 LDKThirtyTwoBytes b_ref;
18647 CHECK((*env)->GetArrayLength(env, b) == 32);
18648 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
18649 LDKInvoiceSignature c_conv;
18650 c_conv.inner = (void*)(c & (~1));
18651 c_conv.is_owned = (c & 1) || (c == 0);
18652 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
18653 c_conv = InvoiceSignature_clone(&c_conv);
18654 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
18655 *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
18656 return ((int64_t)ret_conv);
18659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18660 if ((_res & 1) != 0) return;
18661 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18662 CHECK_ACCESS(_res_ptr);
18663 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
18665 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
18668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18669 LDKPayeePubKey o_conv;
18670 o_conv.inner = (void*)(o & (~1));
18671 o_conv.is_owned = (o & 1) || (o == 0);
18672 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18673 o_conv = PayeePubKey_clone(&o_conv);
18674 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18675 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
18676 return (int64_t)ret_conv;
18679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18680 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
18681 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18682 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
18683 return (int64_t)ret_conv;
18686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18687 LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)(o & ~1);
18688 jboolean ret_val = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
18692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18693 if ((_res & 1) != 0) return;
18694 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18695 CHECK_ACCESS(_res_ptr);
18696 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
18698 CResult_PayeePubKeyErrorZ_free(_res_conv);
18701 static inline uintptr_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
18702 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18703 *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
18704 return (int64_t)ret_conv;
18706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18707 LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
18708 int64_t ret_val = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
18712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18713 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
18714 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
18715 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
18716 return (int64_t)ret_conv;
18719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
18720 LDKCVec_PrivateRouteZ _res_constr;
18721 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
18722 if (_res_constr.datalen > 0)
18723 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
18725 _res_constr.data = NULL;
18726 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
18727 for (size_t o = 0; o < _res_constr.datalen; o++) {
18728 int64_t _res_conv_14 = _res_vals[o];
18729 LDKPrivateRoute _res_conv_14_conv;
18730 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
18731 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
18732 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
18733 _res_constr.data[o] = _res_conv_14_conv;
18735 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
18736 CVec_PrivateRouteZ_free(_res_constr);
18739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18740 LDKPositiveTimestamp o_conv;
18741 o_conv.inner = (void*)(o & (~1));
18742 o_conv.is_owned = (o & 1) || (o == 0);
18743 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18744 o_conv = PositiveTimestamp_clone(&o_conv);
18745 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
18746 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
18747 return (int64_t)ret_conv;
18750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18751 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
18752 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
18753 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
18754 return (int64_t)ret_conv;
18757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18758 LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(o & ~1);
18759 jboolean ret_val = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
18763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18764 if ((_res & 1) != 0) return;
18765 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18766 CHECK_ACCESS(_res_ptr);
18767 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
18769 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
18772 static inline uintptr_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
18773 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
18774 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
18775 return (int64_t)ret_conv;
18777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18778 LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
18779 int64_t ret_val = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
18783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18784 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
18785 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
18786 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
18787 return (int64_t)ret_conv;
18790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
18791 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
18792 *ret_conv = CResult_NoneSemanticErrorZ_ok();
18793 return (int64_t)ret_conv;
18796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18797 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
18798 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
18799 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
18800 return (int64_t)ret_conv;
18803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18804 LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)(o & ~1);
18805 jboolean ret_val = CResult_NoneSemanticErrorZ_is_ok(o_conv);
18809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18810 if ((_res & 1) != 0) return;
18811 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18812 CHECK_ACCESS(_res_ptr);
18813 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
18815 CResult_NoneSemanticErrorZ_free(_res_conv);
18818 static inline uintptr_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
18819 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
18820 *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
18821 return (int64_t)ret_conv;
18823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18824 LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
18825 int64_t ret_val = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
18829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18830 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
18831 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
18832 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
18833 return (int64_t)ret_conv;
18836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18838 o_conv.inner = (void*)(o & (~1));
18839 o_conv.is_owned = (o & 1) || (o == 0);
18840 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18841 o_conv = Invoice_clone(&o_conv);
18842 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
18843 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
18844 return (int64_t)ret_conv;
18847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18848 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
18849 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
18850 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
18851 return (int64_t)ret_conv;
18854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18855 LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)(o & ~1);
18856 jboolean ret_val = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
18860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18861 if ((_res & 1) != 0) return;
18862 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18863 CHECK_ACCESS(_res_ptr);
18864 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
18866 CResult_InvoiceSemanticErrorZ_free(_res_conv);
18869 static inline uintptr_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
18870 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
18871 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
18872 return (int64_t)ret_conv;
18874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18875 LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
18876 int64_t ret_val = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
18880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18881 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
18882 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
18883 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
18884 return (int64_t)ret_conv;
18887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18888 LDKDescription o_conv;
18889 o_conv.inner = (void*)(o & (~1));
18890 o_conv.is_owned = (o & 1) || (o == 0);
18891 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18892 o_conv = Description_clone(&o_conv);
18893 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
18894 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
18895 return (int64_t)ret_conv;
18898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18899 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
18900 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
18901 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
18902 return (int64_t)ret_conv;
18905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18906 LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)(o & ~1);
18907 jboolean ret_val = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
18911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18912 if ((_res & 1) != 0) return;
18913 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18914 CHECK_ACCESS(_res_ptr);
18915 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
18917 CResult_DescriptionCreationErrorZ_free(_res_conv);
18920 static inline uintptr_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
18921 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
18922 *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
18923 return (int64_t)ret_conv;
18925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18926 LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
18927 int64_t ret_val = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
18931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18932 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
18933 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
18934 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
18935 return (int64_t)ret_conv;
18938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
18939 LDKPrivateRoute o_conv;
18940 o_conv.inner = (void*)(o & (~1));
18941 o_conv.is_owned = (o & 1) || (o == 0);
18942 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18943 o_conv = PrivateRoute_clone(&o_conv);
18944 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
18945 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
18946 return (int64_t)ret_conv;
18949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18950 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
18951 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
18952 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
18953 return (int64_t)ret_conv;
18956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
18957 LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(o & ~1);
18958 jboolean ret_val = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
18962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
18963 if ((_res & 1) != 0) return;
18964 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
18965 CHECK_ACCESS(_res_ptr);
18966 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
18968 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
18971 static inline uintptr_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
18972 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
18973 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
18974 return (int64_t)ret_conv;
18976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
18977 LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
18978 int64_t ret_val = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
18982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18983 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
18984 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
18985 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
18986 return (int64_t)ret_conv;
18989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
18990 LDKStr o_conv = java_to_owned_str(env, o);
18991 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18992 *ret_conv = CResult_StringErrorZ_ok(o_conv);
18993 return (int64_t)ret_conv;
18996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
18997 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
18998 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
18999 *ret_conv = CResult_StringErrorZ_err(e_conv);
19000 return (int64_t)ret_conv;
19003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19004 LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)(o & ~1);
19005 jboolean ret_val = CResult_StringErrorZ_is_ok(o_conv);
19009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19010 if ((_res & 1) != 0) return;
19011 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19012 CHECK_ACCESS(_res_ptr);
19013 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
19015 CResult_StringErrorZ_free(_res_conv);
19018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19019 LDKChannelMonitorUpdate o_conv;
19020 o_conv.inner = (void*)(o & (~1));
19021 o_conv.is_owned = (o & 1) || (o == 0);
19022 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19023 o_conv = ChannelMonitorUpdate_clone(&o_conv);
19024 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19025 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
19026 return (int64_t)ret_conv;
19029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19030 LDKDecodeError e_conv;
19031 e_conv.inner = (void*)(e & (~1));
19032 e_conv.is_owned = (e & 1) || (e == 0);
19033 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19034 e_conv = DecodeError_clone(&e_conv);
19035 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19036 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
19037 return (int64_t)ret_conv;
19040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19041 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(o & ~1);
19042 jboolean ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
19046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19047 if ((_res & 1) != 0) return;
19048 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19049 CHECK_ACCESS(_res_ptr);
19050 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
19052 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
19055 static inline uintptr_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
19056 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19057 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
19058 return (int64_t)ret_conv;
19060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19061 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
19062 int64_t ret_val = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
19066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19067 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
19068 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
19069 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
19070 return (int64_t)ret_conv;
19073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
19074 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19075 CHECK_ACCESS(o_ptr);
19076 LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
19077 o_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uintptr_t)o) & ~1));
19078 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19079 *ret_copy = COption_MonitorEventZ_some(o_conv);
19080 int64_t ret_ref = (uintptr_t)ret_copy;
19084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
19085 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19086 *ret_copy = COption_MonitorEventZ_none();
19087 int64_t ret_ref = (uintptr_t)ret_copy;
19091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19092 if ((_res & 1) != 0) return;
19093 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19094 CHECK_ACCESS(_res_ptr);
19095 LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
19097 COption_MonitorEventZ_free(_res_conv);
19100 static inline uintptr_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
19101 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19102 *ret_copy = COption_MonitorEventZ_clone(arg);
19103 int64_t ret_ref = (uintptr_t)ret_copy;
19106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19107 LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)arg;
19108 int64_t ret_val = COption_MonitorEventZ_clone_ptr(arg_conv);
19112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19113 LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)orig;
19114 LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
19115 *ret_copy = COption_MonitorEventZ_clone(orig_conv);
19116 int64_t ret_ref = (uintptr_t)ret_copy;
19120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19121 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19122 CHECK_ACCESS(o_ptr);
19123 LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
19124 o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)(((uintptr_t)o) & ~1));
19125 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19126 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
19127 return (int64_t)ret_conv;
19130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19131 LDKDecodeError e_conv;
19132 e_conv.inner = (void*)(e & (~1));
19133 e_conv.is_owned = (e & 1) || (e == 0);
19134 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19135 e_conv = DecodeError_clone(&e_conv);
19136 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19137 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
19138 return (int64_t)ret_conv;
19141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19142 LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(o & ~1);
19143 jboolean ret_val = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
19147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19148 if ((_res & 1) != 0) return;
19149 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19150 CHECK_ACCESS(_res_ptr);
19151 LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
19153 CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
19156 static inline uintptr_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
19157 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19158 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
19159 return (int64_t)ret_conv;
19161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19162 LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(arg & ~1);
19163 int64_t ret_val = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
19167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19168 LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)(orig & ~1);
19169 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
19170 *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
19171 return (int64_t)ret_conv;
19174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19175 LDKHTLCUpdate o_conv;
19176 o_conv.inner = (void*)(o & (~1));
19177 o_conv.is_owned = (o & 1) || (o == 0);
19178 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19179 o_conv = HTLCUpdate_clone(&o_conv);
19180 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19181 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
19182 return (int64_t)ret_conv;
19185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19186 LDKDecodeError e_conv;
19187 e_conv.inner = (void*)(e & (~1));
19188 e_conv.is_owned = (e & 1) || (e == 0);
19189 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19190 e_conv = DecodeError_clone(&e_conv);
19191 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19192 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
19193 return (int64_t)ret_conv;
19196 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19197 LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(o & ~1);
19198 jboolean ret_val = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
19202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19203 if ((_res & 1) != 0) return;
19204 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19205 CHECK_ACCESS(_res_ptr);
19206 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
19208 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
19211 static inline uintptr_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
19212 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19213 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
19214 return (int64_t)ret_conv;
19216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19217 LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
19218 int64_t ret_val = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
19222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19223 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
19224 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
19225 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
19226 return (int64_t)ret_conv;
19229 static inline uintptr_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
19230 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19231 *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
19232 return ((int64_t)ret_conv);
19234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19235 LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)(arg & ~1);
19236 int64_t ret_val = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
19240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19241 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
19242 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19243 *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
19244 return ((int64_t)ret_conv);
19247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
19248 LDKOutPoint a_conv;
19249 a_conv.inner = (void*)(a & (~1));
19250 a_conv.is_owned = (a & 1) || (a == 0);
19251 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19252 a_conv = OutPoint_clone(&a_conv);
19254 b_ref.datalen = (*env)->GetArrayLength(env, b);
19255 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
19256 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
19257 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
19258 *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
19259 return ((int64_t)ret_conv);
19262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_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 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
19268 C2Tuple_OutPointScriptZ_free(_res_conv);
19271 static inline uintptr_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
19272 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19273 *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
19274 return ((int64_t)ret_conv);
19276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19277 LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)(arg & ~1);
19278 int64_t ret_val = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
19282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19283 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
19284 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19285 *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
19286 return ((int64_t)ret_conv);
19289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
19291 b_ref.datalen = (*env)->GetArrayLength(env, b);
19292 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
19293 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
19294 LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
19295 *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
19296 return ((int64_t)ret_conv);
19299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19300 if ((_res & 1) != 0) return;
19301 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19302 CHECK_ACCESS(_res_ptr);
19303 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
19305 C2Tuple_u32ScriptZ_free(_res_conv);
19308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19309 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
19310 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19311 if (_res_constr.datalen > 0)
19312 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
19314 _res_constr.data = NULL;
19315 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19316 for (size_t v = 0; v < _res_constr.datalen; v++) {
19317 int64_t _res_conv_21 = _res_vals[v];
19318 void* _res_conv_21_ptr = (void*)(((uintptr_t)_res_conv_21) & ~1);
19319 CHECK_ACCESS(_res_conv_21_ptr);
19320 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
19321 FREE((void*)_res_conv_21);
19322 _res_constr.data[v] = _res_conv_21_conv;
19324 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19325 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
19328 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
19329 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19330 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
19331 return ((int64_t)ret_conv);
19333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19334 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(arg & ~1);
19335 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
19339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19340 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
19341 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19342 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
19343 return ((int64_t)ret_conv);
19346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
19347 LDKThirtyTwoBytes a_ref;
19348 CHECK((*env)->GetArrayLength(env, a) == 32);
19349 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19350 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
19351 b_constr.datalen = (*env)->GetArrayLength(env, b);
19352 if (b_constr.datalen > 0)
19353 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
19355 b_constr.data = NULL;
19356 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
19357 for (size_t v = 0; v < b_constr.datalen; v++) {
19358 int64_t b_conv_21 = b_vals[v];
19359 void* b_conv_21_ptr = (void*)(((uintptr_t)b_conv_21) & ~1);
19360 CHECK_ACCESS(b_conv_21_ptr);
19361 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
19362 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uintptr_t)b_conv_21) & ~1));
19363 b_constr.data[v] = b_conv_21_conv;
19365 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
19366 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
19367 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
19368 return ((int64_t)ret_conv);
19371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19372 if ((_res & 1) != 0) return;
19373 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19374 CHECK_ACCESS(_res_ptr);
19375 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
19377 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
19380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19381 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
19382 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19383 if (_res_constr.datalen > 0)
19384 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
19386 _res_constr.data = NULL;
19387 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19388 for (size_t o = 0; o < _res_constr.datalen; o++) {
19389 int64_t _res_conv_40 = _res_vals[o];
19390 void* _res_conv_40_ptr = (void*)(((uintptr_t)_res_conv_40) & ~1);
19391 CHECK_ACCESS(_res_conv_40_ptr);
19392 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
19393 FREE((void*)_res_conv_40);
19394 _res_constr.data[o] = _res_conv_40_conv;
19396 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19397 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
19400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19401 LDKCVec_EventZ _res_constr;
19402 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19403 if (_res_constr.datalen > 0)
19404 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
19406 _res_constr.data = NULL;
19407 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19408 for (size_t h = 0; h < _res_constr.datalen; h++) {
19409 int64_t _res_conv_7 = _res_vals[h];
19410 void* _res_conv_7_ptr = (void*)(((uintptr_t)_res_conv_7) & ~1);
19411 CHECK_ACCESS(_res_conv_7_ptr);
19412 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
19413 FREE((void*)_res_conv_7);
19414 _res_constr.data[h] = _res_conv_7_conv;
19416 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19417 CVec_EventZ_free(_res_constr);
19420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19421 LDKCVec_TransactionZ _res_constr;
19422 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19423 if (_res_constr.datalen > 0)
19424 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
19426 _res_constr.data = NULL;
19427 for (size_t i = 0; i < _res_constr.datalen; i++) {
19428 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19429 LDKTransaction _res_conv_8_ref;
19430 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
19431 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
19432 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
19433 _res_conv_8_ref.data_is_owned = true;
19434 _res_constr.data[i] = _res_conv_8_ref;
19436 CVec_TransactionZ_free(_res_constr);
19439 static inline uintptr_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
19440 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19441 *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
19442 return ((int64_t)ret_conv);
19444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19445 LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)(arg & ~1);
19446 int64_t ret_val = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
19450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19451 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
19452 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19453 *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
19454 return ((int64_t)ret_conv);
19457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
19458 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
19459 CHECK_ACCESS(b_ptr);
19460 LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
19461 b_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)b) & ~1));
19462 LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
19463 *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
19464 return ((int64_t)ret_conv);
19467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19468 if ((_res & 1) != 0) return;
19469 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19470 CHECK_ACCESS(_res_ptr);
19471 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
19473 C2Tuple_u32TxOutZ_free(_res_conv);
19476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19477 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
19478 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19479 if (_res_constr.datalen > 0)
19480 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19482 _res_constr.data = NULL;
19483 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19484 for (size_t u = 0; u < _res_constr.datalen; u++) {
19485 int64_t _res_conv_20 = _res_vals[u];
19486 void* _res_conv_20_ptr = (void*)(((uintptr_t)_res_conv_20) & ~1);
19487 CHECK_ACCESS(_res_conv_20_ptr);
19488 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
19489 FREE((void*)_res_conv_20);
19490 _res_constr.data[u] = _res_conv_20_conv;
19492 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19493 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
19496 static inline uintptr_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
19497 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19498 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
19499 return ((int64_t)ret_conv);
19501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19502 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(arg & ~1);
19503 int64_t ret_val = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
19507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19508 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
19509 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19510 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
19511 return ((int64_t)ret_conv);
19514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
19515 LDKThirtyTwoBytes a_ref;
19516 CHECK((*env)->GetArrayLength(env, a) == 32);
19517 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
19518 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
19519 b_constr.datalen = (*env)->GetArrayLength(env, b);
19520 if (b_constr.datalen > 0)
19521 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
19523 b_constr.data = NULL;
19524 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
19525 for (size_t u = 0; u < b_constr.datalen; u++) {
19526 int64_t b_conv_20 = b_vals[u];
19527 void* b_conv_20_ptr = (void*)(((uintptr_t)b_conv_20) & ~1);
19528 CHECK_ACCESS(b_conv_20_ptr);
19529 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
19530 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uintptr_t)b_conv_20) & ~1));
19531 b_constr.data[u] = b_conv_20_conv;
19533 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
19534 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
19535 *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
19536 return ((int64_t)ret_conv);
19539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19540 if ((_res & 1) != 0) return;
19541 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19542 CHECK_ACCESS(_res_ptr);
19543 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
19545 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
19548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19549 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
19550 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19551 if (_res_constr.datalen > 0)
19552 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
19554 _res_constr.data = NULL;
19555 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19556 for (size_t n = 0; n < _res_constr.datalen; n++) {
19557 int64_t _res_conv_39 = _res_vals[n];
19558 void* _res_conv_39_ptr = (void*)(((uintptr_t)_res_conv_39) & ~1);
19559 CHECK_ACCESS(_res_conv_39_ptr);
19560 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
19561 FREE((void*)_res_conv_39);
19562 _res_constr.data[n] = _res_conv_39_conv;
19564 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19565 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
19568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19569 LDKCVec_BalanceZ _res_constr;
19570 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19571 if (_res_constr.datalen > 0)
19572 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
19574 _res_constr.data = NULL;
19575 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19576 for (size_t j = 0; j < _res_constr.datalen; j++) {
19577 int64_t _res_conv_9 = _res_vals[j];
19578 void* _res_conv_9_ptr = (void*)(((uintptr_t)_res_conv_9) & ~1);
19579 CHECK_ACCESS(_res_conv_9_ptr);
19580 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
19581 FREE((void*)_res_conv_9);
19582 _res_constr.data[j] = _res_conv_9_conv;
19584 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19585 CVec_BalanceZ_free(_res_constr);
19588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
19589 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
19590 CHECK_ACCESS(o_ptr);
19591 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
19592 o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)(((uintptr_t)o) & ~1));
19593 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19594 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
19595 return (int64_t)ret_conv;
19598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19599 LDKDecodeError e_conv;
19600 e_conv.inner = (void*)(e & (~1));
19601 e_conv.is_owned = (e & 1) || (e == 0);
19602 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19603 e_conv = DecodeError_clone(&e_conv);
19604 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19605 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
19606 return (int64_t)ret_conv;
19609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19610 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(o & ~1);
19611 jboolean ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
19615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19616 if ((_res & 1) != 0) return;
19617 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19618 CHECK_ACCESS(_res_ptr);
19619 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
19621 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
19624 static inline uintptr_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
19625 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19626 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
19627 return (int64_t)ret_conv;
19629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19630 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
19631 int64_t ret_val = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
19635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19636 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(orig & ~1);
19637 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
19638 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
19639 return (int64_t)ret_conv;
19642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
19643 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19644 *ret_conv = CResult_NoneLightningErrorZ_ok();
19645 return (int64_t)ret_conv;
19648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19649 LDKLightningError e_conv;
19650 e_conv.inner = (void*)(e & (~1));
19651 e_conv.is_owned = (e & 1) || (e == 0);
19652 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19653 e_conv = LightningError_clone(&e_conv);
19654 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19655 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
19656 return (int64_t)ret_conv;
19659 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19660 LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)(o & ~1);
19661 jboolean ret_val = CResult_NoneLightningErrorZ_is_ok(o_conv);
19665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19666 if ((_res & 1) != 0) return;
19667 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19668 CHECK_ACCESS(_res_ptr);
19669 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
19671 CResult_NoneLightningErrorZ_free(_res_conv);
19674 static inline uintptr_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
19675 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19676 *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
19677 return (int64_t)ret_conv;
19679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19680 LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
19681 int64_t ret_val = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
19685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19686 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
19687 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19688 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
19689 return (int64_t)ret_conv;
19692 static inline uintptr_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
19693 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19694 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
19695 return ((int64_t)ret_conv);
19697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19698 LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)(arg & ~1);
19699 int64_t ret_val = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
19703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19704 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
19705 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19706 *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
19707 return ((int64_t)ret_conv);
19710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
19711 LDKPublicKey a_ref;
19712 CHECK((*env)->GetArrayLength(env, a) == 33);
19713 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
19714 void* b_ptr = (void*)(((uintptr_t)b) & ~1);
19715 CHECK_ACCESS(b_ptr);
19716 LDKType b_conv = *(LDKType*)(b_ptr);
19717 if (b_conv.free == LDKType_JCalls_free) {
19718 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19719 LDKType_JCalls_cloned(&b_conv);
19721 LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
19722 *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
19723 return ((int64_t)ret_conv);
19726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19727 if ((_res & 1) != 0) return;
19728 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19729 CHECK_ACCESS(_res_ptr);
19730 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
19732 C2Tuple_PublicKeyTypeZ_free(_res_conv);
19735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19736 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
19737 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19738 if (_res_constr.datalen > 0)
19739 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
19741 _res_constr.data = NULL;
19742 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19743 for (size_t z = 0; z < _res_constr.datalen; z++) {
19744 int64_t _res_conv_25 = _res_vals[z];
19745 void* _res_conv_25_ptr = (void*)(((uintptr_t)_res_conv_25) & ~1);
19746 CHECK_ACCESS(_res_conv_25_ptr);
19747 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
19748 FREE((void*)_res_conv_25);
19749 _res_constr.data[z] = _res_conv_25_conv;
19751 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19752 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
19755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
19756 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19757 *ret_conv = CResult_boolLightningErrorZ_ok(o);
19758 return (int64_t)ret_conv;
19761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19762 LDKLightningError e_conv;
19763 e_conv.inner = (void*)(e & (~1));
19764 e_conv.is_owned = (e & 1) || (e == 0);
19765 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19766 e_conv = LightningError_clone(&e_conv);
19767 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19768 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
19769 return (int64_t)ret_conv;
19772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19773 LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)(o & ~1);
19774 jboolean ret_val = CResult_boolLightningErrorZ_is_ok(o_conv);
19778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19779 if ((_res & 1) != 0) return;
19780 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19781 CHECK_ACCESS(_res_ptr);
19782 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
19784 CResult_boolLightningErrorZ_free(_res_conv);
19787 static inline uintptr_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
19788 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19789 *ret_conv = CResult_boolLightningErrorZ_clone(arg);
19790 return (int64_t)ret_conv;
19792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19793 LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
19794 int64_t ret_val = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
19798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19799 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
19800 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19801 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
19802 return (int64_t)ret_conv;
19805 static inline uintptr_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
19806 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19807 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
19808 return ((int64_t)ret_conv);
19810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19811 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(arg & ~1);
19812 int64_t ret_val = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
19816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19817 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
19818 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19819 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
19820 return ((int64_t)ret_conv);
19823 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) {
19824 LDKChannelAnnouncement a_conv;
19825 a_conv.inner = (void*)(a & (~1));
19826 a_conv.is_owned = (a & 1) || (a == 0);
19827 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19828 a_conv = ChannelAnnouncement_clone(&a_conv);
19829 LDKChannelUpdate b_conv;
19830 b_conv.inner = (void*)(b & (~1));
19831 b_conv.is_owned = (b & 1) || (b == 0);
19832 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19833 b_conv = ChannelUpdate_clone(&b_conv);
19834 LDKChannelUpdate c_conv;
19835 c_conv.inner = (void*)(c & (~1));
19836 c_conv.is_owned = (c & 1) || (c == 0);
19837 CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19838 c_conv = ChannelUpdate_clone(&c_conv);
19839 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19840 *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
19841 return ((int64_t)ret_conv);
19844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19845 if ((_res & 1) != 0) return;
19846 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19847 CHECK_ACCESS(_res_ptr);
19848 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
19850 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
19853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19854 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
19855 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19856 if (_res_constr.datalen > 0)
19857 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
19859 _res_constr.data = NULL;
19860 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19861 for (size_t h = 0; h < _res_constr.datalen; h++) {
19862 int64_t _res_conv_59 = _res_vals[h];
19863 void* _res_conv_59_ptr = (void*)(((uintptr_t)_res_conv_59) & ~1);
19864 CHECK_ACCESS(_res_conv_59_ptr);
19865 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_59_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_conv_59_ptr);
19866 FREE((void*)_res_conv_59);
19867 _res_constr.data[h] = _res_conv_59_conv;
19869 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19870 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
19873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
19874 LDKCVec_NodeAnnouncementZ _res_constr;
19875 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19876 if (_res_constr.datalen > 0)
19877 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
19879 _res_constr.data = NULL;
19880 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
19881 for (size_t s = 0; s < _res_constr.datalen; s++) {
19882 int64_t _res_conv_18 = _res_vals[s];
19883 LDKNodeAnnouncement _res_conv_18_conv;
19884 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
19885 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
19886 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_18_conv);
19887 _res_constr.data[s] = _res_conv_18_conv;
19889 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
19890 CVec_NodeAnnouncementZ_free(_res_constr);
19893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
19894 LDKCVec_PublicKeyZ _res_constr;
19895 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
19896 if (_res_constr.datalen > 0)
19897 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
19899 _res_constr.data = NULL;
19900 for (size_t i = 0; i < _res_constr.datalen; i++) {
19901 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
19902 LDKPublicKey _res_conv_8_ref;
19903 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
19904 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
19905 _res_constr.data[i] = _res_conv_8_ref;
19907 CVec_PublicKeyZ_free(_res_constr);
19910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
19912 o_ref.datalen = (*env)->GetArrayLength(env, o);
19913 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
19914 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
19915 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19916 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
19917 return (int64_t)ret_conv;
19920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19921 LDKPeerHandleError e_conv;
19922 e_conv.inner = (void*)(e & (~1));
19923 e_conv.is_owned = (e & 1) || (e == 0);
19924 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19925 e_conv = PeerHandleError_clone(&e_conv);
19926 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19927 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
19928 return (int64_t)ret_conv;
19931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19932 LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(o & ~1);
19933 jboolean ret_val = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
19937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19938 if ((_res & 1) != 0) return;
19939 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19940 CHECK_ACCESS(_res_ptr);
19941 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
19943 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
19946 static inline uintptr_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
19947 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19948 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
19949 return (int64_t)ret_conv;
19951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
19952 LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
19953 int64_t ret_val = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
19957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19958 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
19959 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
19960 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
19961 return (int64_t)ret_conv;
19964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
19965 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19966 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
19967 return (int64_t)ret_conv;
19970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
19971 LDKPeerHandleError e_conv;
19972 e_conv.inner = (void*)(e & (~1));
19973 e_conv.is_owned = (e & 1) || (e == 0);
19974 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19975 e_conv = PeerHandleError_clone(&e_conv);
19976 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19977 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
19978 return (int64_t)ret_conv;
19981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
19982 LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)(o & ~1);
19983 jboolean ret_val = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
19987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
19988 if ((_res & 1) != 0) return;
19989 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
19990 CHECK_ACCESS(_res_ptr);
19991 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
19993 CResult_NonePeerHandleErrorZ_free(_res_conv);
19996 static inline uintptr_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
19997 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
19998 *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
19999 return (int64_t)ret_conv;
20001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20002 LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
20003 int64_t ret_val = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
20007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20008 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
20009 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20010 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
20011 return (int64_t)ret_conv;
20014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
20015 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20016 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
20017 return (int64_t)ret_conv;
20020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20021 LDKPeerHandleError e_conv;
20022 e_conv.inner = (void*)(e & (~1));
20023 e_conv.is_owned = (e & 1) || (e == 0);
20024 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20025 e_conv = PeerHandleError_clone(&e_conv);
20026 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20027 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
20028 return (int64_t)ret_conv;
20031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20032 LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)(o & ~1);
20033 jboolean ret_val = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
20037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20038 if ((_res & 1) != 0) return;
20039 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20040 CHECK_ACCESS(_res_ptr);
20041 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
20043 CResult_boolPeerHandleErrorZ_free(_res_conv);
20046 static inline uintptr_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
20047 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20048 *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
20049 return (int64_t)ret_conv;
20051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20052 LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
20053 int64_t ret_val = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
20057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20058 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
20059 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20060 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
20061 return (int64_t)ret_conv;
20064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20066 o_conv.inner = (void*)(o & (~1));
20067 o_conv.is_owned = (o & 1) || (o == 0);
20068 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20069 o_conv = NodeId_clone(&o_conv);
20070 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20071 *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
20072 return (int64_t)ret_conv;
20075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20076 LDKDecodeError e_conv;
20077 e_conv.inner = (void*)(e & (~1));
20078 e_conv.is_owned = (e & 1) || (e == 0);
20079 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20080 e_conv = DecodeError_clone(&e_conv);
20081 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20082 *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
20083 return (int64_t)ret_conv;
20086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20087 LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)(o & ~1);
20088 jboolean ret_val = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
20092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20093 if ((_res & 1) != 0) return;
20094 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20095 CHECK_ACCESS(_res_ptr);
20096 LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
20098 CResult_NodeIdDecodeErrorZ_free(_res_conv);
20101 static inline uintptr_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
20102 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20103 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
20104 return (int64_t)ret_conv;
20106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20107 LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1);
20108 int64_t ret_val = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
20112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20113 LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1);
20114 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
20115 *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
20116 return (int64_t)ret_conv;
20119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20120 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20121 CHECK_ACCESS(o_ptr);
20122 LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
20123 o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)o) & ~1));
20124 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20125 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
20126 return (int64_t)ret_conv;
20129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20130 LDKDecodeError e_conv;
20131 e_conv.inner = (void*)(e & (~1));
20132 e_conv.is_owned = (e & 1) || (e == 0);
20133 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20134 e_conv = DecodeError_clone(&e_conv);
20135 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20136 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
20137 return (int64_t)ret_conv;
20140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20141 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(o & ~1);
20142 jboolean ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
20146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20147 if ((_res & 1) != 0) return;
20148 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20149 CHECK_ACCESS(_res_ptr);
20150 LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
20152 CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
20155 static inline uintptr_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
20156 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20157 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
20158 return (int64_t)ret_conv;
20160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20161 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(arg & ~1);
20162 int64_t ret_val = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
20166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20167 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(orig & ~1);
20168 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
20169 *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
20170 return (int64_t)ret_conv;
20173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
20174 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20175 CHECK_ACCESS(o_ptr);
20176 LDKAccess o_conv = *(LDKAccess*)(o_ptr);
20177 if (o_conv.free == LDKAccess_JCalls_free) {
20178 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20179 LDKAccess_JCalls_cloned(&o_conv);
20181 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
20182 *ret_copy = COption_AccessZ_some(o_conv);
20183 int64_t ret_ref = (uintptr_t)ret_copy;
20187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
20188 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
20189 *ret_copy = COption_AccessZ_none();
20190 int64_t ret_ref = (uintptr_t)ret_copy;
20194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20195 if ((_res & 1) != 0) return;
20196 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20197 CHECK_ACCESS(_res_ptr);
20198 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
20200 COption_AccessZ_free(_res_conv);
20203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20204 LDKChannelUpdateInfo o_conv;
20205 o_conv.inner = (void*)(o & (~1));
20206 o_conv.is_owned = (o & 1) || (o == 0);
20207 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20208 o_conv = ChannelUpdateInfo_clone(&o_conv);
20209 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20210 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
20211 return (int64_t)ret_conv;
20214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20215 LDKDecodeError e_conv;
20216 e_conv.inner = (void*)(e & (~1));
20217 e_conv.is_owned = (e & 1) || (e == 0);
20218 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20219 e_conv = DecodeError_clone(&e_conv);
20220 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20221 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
20222 return (int64_t)ret_conv;
20225 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20226 LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(o & ~1);
20227 jboolean ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
20231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20232 if ((_res & 1) != 0) return;
20233 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20234 CHECK_ACCESS(_res_ptr);
20235 LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
20237 CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
20240 static inline uintptr_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
20241 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20242 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
20243 return (int64_t)ret_conv;
20245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20246 LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(arg & ~1);
20247 int64_t ret_val = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
20251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20252 LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(orig & ~1);
20253 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
20254 *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
20255 return (int64_t)ret_conv;
20258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20259 LDKChannelInfo o_conv;
20260 o_conv.inner = (void*)(o & (~1));
20261 o_conv.is_owned = (o & 1) || (o == 0);
20262 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20263 o_conv = ChannelInfo_clone(&o_conv);
20264 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20265 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
20266 return (int64_t)ret_conv;
20269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20270 LDKDecodeError e_conv;
20271 e_conv.inner = (void*)(e & (~1));
20272 e_conv.is_owned = (e & 1) || (e == 0);
20273 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20274 e_conv = DecodeError_clone(&e_conv);
20275 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20276 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
20277 return (int64_t)ret_conv;
20280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20281 LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(o & ~1);
20282 jboolean ret_val = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
20286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20287 if ((_res & 1) != 0) return;
20288 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20289 CHECK_ACCESS(_res_ptr);
20290 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
20292 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
20295 static inline uintptr_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
20296 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20297 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
20298 return (int64_t)ret_conv;
20300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20301 LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
20302 int64_t ret_val = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
20306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20307 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
20308 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
20309 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
20310 return (int64_t)ret_conv;
20313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20314 LDKRoutingFees o_conv;
20315 o_conv.inner = (void*)(o & (~1));
20316 o_conv.is_owned = (o & 1) || (o == 0);
20317 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20318 o_conv = RoutingFees_clone(&o_conv);
20319 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20320 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
20321 return (int64_t)ret_conv;
20324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20325 LDKDecodeError e_conv;
20326 e_conv.inner = (void*)(e & (~1));
20327 e_conv.is_owned = (e & 1) || (e == 0);
20328 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20329 e_conv = DecodeError_clone(&e_conv);
20330 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20331 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
20332 return (int64_t)ret_conv;
20335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20336 LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(o & ~1);
20337 jboolean ret_val = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
20341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20342 if ((_res & 1) != 0) return;
20343 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20344 CHECK_ACCESS(_res_ptr);
20345 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
20347 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
20350 static inline uintptr_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
20351 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20352 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
20353 return (int64_t)ret_conv;
20355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20356 LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
20357 int64_t ret_val = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
20361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20362 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
20363 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
20364 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
20365 return (int64_t)ret_conv;
20368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20369 LDKNodeAnnouncementInfo o_conv;
20370 o_conv.inner = (void*)(o & (~1));
20371 o_conv.is_owned = (o & 1) || (o == 0);
20372 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20373 o_conv = NodeAnnouncementInfo_clone(&o_conv);
20374 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20375 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
20376 return (int64_t)ret_conv;
20379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20380 LDKDecodeError e_conv;
20381 e_conv.inner = (void*)(e & (~1));
20382 e_conv.is_owned = (e & 1) || (e == 0);
20383 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20384 e_conv = DecodeError_clone(&e_conv);
20385 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20386 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
20387 return (int64_t)ret_conv;
20390 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20391 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(o & ~1);
20392 jboolean ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
20396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20397 if ((_res & 1) != 0) return;
20398 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20399 CHECK_ACCESS(_res_ptr);
20400 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
20402 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
20405 static inline uintptr_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
20406 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20407 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
20408 return (int64_t)ret_conv;
20410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20411 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
20412 int64_t ret_val = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
20416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20417 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
20418 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
20419 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
20420 return (int64_t)ret_conv;
20423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20424 LDKCVec_u64Z _res_constr;
20425 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20426 if (_res_constr.datalen > 0)
20427 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20429 _res_constr.data = NULL;
20430 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20431 for (size_t g = 0; g < _res_constr.datalen; g++) {
20432 int64_t _res_conv_6 = _res_vals[g];
20433 _res_constr.data[g] = _res_conv_6;
20435 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20436 CVec_u64Z_free(_res_constr);
20439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20440 LDKNodeInfo o_conv;
20441 o_conv.inner = (void*)(o & (~1));
20442 o_conv.is_owned = (o & 1) || (o == 0);
20443 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20444 o_conv = NodeInfo_clone(&o_conv);
20445 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20446 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
20447 return (int64_t)ret_conv;
20450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20451 LDKDecodeError e_conv;
20452 e_conv.inner = (void*)(e & (~1));
20453 e_conv.is_owned = (e & 1) || (e == 0);
20454 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20455 e_conv = DecodeError_clone(&e_conv);
20456 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20457 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
20458 return (int64_t)ret_conv;
20461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20462 LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(o & ~1);
20463 jboolean ret_val = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
20467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20468 if ((_res & 1) != 0) return;
20469 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20470 CHECK_ACCESS(_res_ptr);
20471 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
20473 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
20476 static inline uintptr_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
20477 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20478 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
20479 return (int64_t)ret_conv;
20481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20482 LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
20483 int64_t ret_val = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
20487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20488 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
20489 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20490 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
20491 return (int64_t)ret_conv;
20494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20495 LDKNetworkGraph o_conv;
20496 o_conv.inner = (void*)(o & (~1));
20497 o_conv.is_owned = (o & 1) || (o == 0);
20498 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20499 o_conv = NetworkGraph_clone(&o_conv);
20500 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20501 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
20502 return (int64_t)ret_conv;
20505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20506 LDKDecodeError e_conv;
20507 e_conv.inner = (void*)(e & (~1));
20508 e_conv.is_owned = (e & 1) || (e == 0);
20509 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20510 e_conv = DecodeError_clone(&e_conv);
20511 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20512 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
20513 return (int64_t)ret_conv;
20516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20517 LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(o & ~1);
20518 jboolean ret_val = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
20522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20523 if ((_res & 1) != 0) return;
20524 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20525 CHECK_ACCESS(_res_ptr);
20526 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
20528 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
20531 static inline uintptr_t CResult_NetworkGraphDecodeErrorZ_clone_ptr(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR arg) {
20532 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20533 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(arg);
20534 return (int64_t)ret_conv;
20536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20537 LDKCResult_NetworkGraphDecodeErrorZ* arg_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
20538 int64_t ret_val = CResult_NetworkGraphDecodeErrorZ_clone_ptr(arg_conv);
20542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20543 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
20544 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20545 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
20546 return (int64_t)ret_conv;
20549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
20550 LDKCVec_NetAddressZ o_constr;
20551 o_constr.datalen = (*env)->GetArrayLength(env, o);
20552 if (o_constr.datalen > 0)
20553 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20555 o_constr.data = NULL;
20556 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
20557 for (size_t m = 0; m < o_constr.datalen; m++) {
20558 int64_t o_conv_12 = o_vals[m];
20559 void* o_conv_12_ptr = (void*)(((uintptr_t)o_conv_12) & ~1);
20560 CHECK_ACCESS(o_conv_12_ptr);
20561 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
20562 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o_conv_12) & ~1));
20563 o_constr.data[m] = o_conv_12_conv;
20565 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
20566 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20567 *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
20568 int64_t ret_ref = (uintptr_t)ret_copy;
20572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) {
20573 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20574 *ret_copy = COption_CVec_NetAddressZZ_none();
20575 int64_t ret_ref = (uintptr_t)ret_copy;
20579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20580 if ((_res & 1) != 0) return;
20581 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20582 CHECK_ACCESS(_res_ptr);
20583 LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
20585 COption_CVec_NetAddressZZ_free(_res_conv);
20588 static inline uintptr_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
20589 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20590 *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
20591 int64_t ret_ref = (uintptr_t)ret_copy;
20594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20595 LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)arg;
20596 int64_t ret_val = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
20600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20601 LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig;
20602 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20603 *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
20604 int64_t ret_ref = (uintptr_t)ret_copy;
20608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20609 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
20610 CHECK_ACCESS(o_ptr);
20611 LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
20612 o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1));
20613 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20614 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
20615 return (int64_t)ret_conv;
20618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20619 LDKDecodeError e_conv;
20620 e_conv.inner = (void*)(e & (~1));
20621 e_conv.is_owned = (e & 1) || (e == 0);
20622 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20623 e_conv = DecodeError_clone(&e_conv);
20624 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20625 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
20626 return (int64_t)ret_conv;
20629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20630 LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)(o & ~1);
20631 jboolean ret_val = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
20635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20636 if ((_res & 1) != 0) return;
20637 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20638 CHECK_ACCESS(_res_ptr);
20639 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
20641 CResult_NetAddressDecodeErrorZ_free(_res_conv);
20644 static inline uintptr_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
20645 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20646 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
20647 return (int64_t)ret_conv;
20649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20650 LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
20651 int64_t ret_val = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
20655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20656 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
20657 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20658 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
20659 return (int64_t)ret_conv;
20662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20663 LDKCVec_UpdateAddHTLCZ _res_constr;
20664 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20665 if (_res_constr.datalen > 0)
20666 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20668 _res_constr.data = NULL;
20669 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20670 for (size_t p = 0; p < _res_constr.datalen; p++) {
20671 int64_t _res_conv_15 = _res_vals[p];
20672 LDKUpdateAddHTLC _res_conv_15_conv;
20673 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
20674 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
20675 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
20676 _res_constr.data[p] = _res_conv_15_conv;
20678 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20679 CVec_UpdateAddHTLCZ_free(_res_constr);
20682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20683 LDKCVec_UpdateFulfillHTLCZ _res_constr;
20684 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20685 if (_res_constr.datalen > 0)
20686 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20688 _res_constr.data = NULL;
20689 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20690 for (size_t t = 0; t < _res_constr.datalen; t++) {
20691 int64_t _res_conv_19 = _res_vals[t];
20692 LDKUpdateFulfillHTLC _res_conv_19_conv;
20693 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
20694 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
20695 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
20696 _res_constr.data[t] = _res_conv_19_conv;
20698 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20699 CVec_UpdateFulfillHTLCZ_free(_res_constr);
20702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20703 LDKCVec_UpdateFailHTLCZ _res_constr;
20704 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20705 if (_res_constr.datalen > 0)
20706 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20708 _res_constr.data = NULL;
20709 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20710 for (size_t q = 0; q < _res_constr.datalen; q++) {
20711 int64_t _res_conv_16 = _res_vals[q];
20712 LDKUpdateFailHTLC _res_conv_16_conv;
20713 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
20714 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
20715 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20716 _res_constr.data[q] = _res_conv_16_conv;
20718 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20719 CVec_UpdateFailHTLCZ_free(_res_constr);
20722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
20723 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
20724 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
20725 if (_res_constr.datalen > 0)
20726 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20728 _res_constr.data = NULL;
20729 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
20730 for (size_t z = 0; z < _res_constr.datalen; z++) {
20731 int64_t _res_conv_25 = _res_vals[z];
20732 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
20733 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
20734 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
20735 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
20736 _res_constr.data[z] = _res_conv_25_conv;
20738 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
20739 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
20742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20743 LDKAcceptChannel o_conv;
20744 o_conv.inner = (void*)(o & (~1));
20745 o_conv.is_owned = (o & 1) || (o == 0);
20746 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20747 o_conv = AcceptChannel_clone(&o_conv);
20748 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20749 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
20750 return (int64_t)ret_conv;
20753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20754 LDKDecodeError e_conv;
20755 e_conv.inner = (void*)(e & (~1));
20756 e_conv.is_owned = (e & 1) || (e == 0);
20757 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20758 e_conv = DecodeError_clone(&e_conv);
20759 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20760 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
20761 return (int64_t)ret_conv;
20764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20765 LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(o & ~1);
20766 jboolean ret_val = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
20770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20771 if ((_res & 1) != 0) return;
20772 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20773 CHECK_ACCESS(_res_ptr);
20774 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
20776 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
20779 static inline uintptr_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
20780 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20781 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
20782 return (int64_t)ret_conv;
20784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20785 LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
20786 int64_t ret_val = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
20790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20791 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
20792 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20793 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
20794 return (int64_t)ret_conv;
20797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20798 LDKAnnouncementSignatures o_conv;
20799 o_conv.inner = (void*)(o & (~1));
20800 o_conv.is_owned = (o & 1) || (o == 0);
20801 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20802 o_conv = AnnouncementSignatures_clone(&o_conv);
20803 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20804 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
20805 return (int64_t)ret_conv;
20808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20809 LDKDecodeError e_conv;
20810 e_conv.inner = (void*)(e & (~1));
20811 e_conv.is_owned = (e & 1) || (e == 0);
20812 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20813 e_conv = DecodeError_clone(&e_conv);
20814 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20815 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
20816 return (int64_t)ret_conv;
20819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20820 LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(o & ~1);
20821 jboolean ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
20825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20826 if ((_res & 1) != 0) return;
20827 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20828 CHECK_ACCESS(_res_ptr);
20829 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
20831 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
20834 static inline uintptr_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
20835 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20836 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
20837 return (int64_t)ret_conv;
20839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20840 LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
20841 int64_t ret_val = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
20845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20846 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
20847 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20848 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
20849 return (int64_t)ret_conv;
20852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20853 LDKChannelReestablish o_conv;
20854 o_conv.inner = (void*)(o & (~1));
20855 o_conv.is_owned = (o & 1) || (o == 0);
20856 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20857 o_conv = ChannelReestablish_clone(&o_conv);
20858 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20859 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
20860 return (int64_t)ret_conv;
20863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20864 LDKDecodeError e_conv;
20865 e_conv.inner = (void*)(e & (~1));
20866 e_conv.is_owned = (e & 1) || (e == 0);
20867 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20868 e_conv = DecodeError_clone(&e_conv);
20869 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20870 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
20871 return (int64_t)ret_conv;
20874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20875 LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(o & ~1);
20876 jboolean ret_val = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
20880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20881 if ((_res & 1) != 0) return;
20882 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20883 CHECK_ACCESS(_res_ptr);
20884 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
20886 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
20889 static inline uintptr_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
20890 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20891 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
20892 return (int64_t)ret_conv;
20894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20895 LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
20896 int64_t ret_val = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
20900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20901 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
20902 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20903 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
20904 return (int64_t)ret_conv;
20907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20908 LDKClosingSigned o_conv;
20909 o_conv.inner = (void*)(o & (~1));
20910 o_conv.is_owned = (o & 1) || (o == 0);
20911 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20912 o_conv = ClosingSigned_clone(&o_conv);
20913 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20914 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
20915 return (int64_t)ret_conv;
20918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20919 LDKDecodeError e_conv;
20920 e_conv.inner = (void*)(e & (~1));
20921 e_conv.is_owned = (e & 1) || (e == 0);
20922 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20923 e_conv = DecodeError_clone(&e_conv);
20924 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20925 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
20926 return (int64_t)ret_conv;
20929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20930 LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(o & ~1);
20931 jboolean ret_val = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
20935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20936 if ((_res & 1) != 0) return;
20937 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20938 CHECK_ACCESS(_res_ptr);
20939 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
20941 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
20944 static inline uintptr_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
20945 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20946 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
20947 return (int64_t)ret_conv;
20949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
20950 LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
20951 int64_t ret_val = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
20955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20956 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
20957 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20958 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
20959 return (int64_t)ret_conv;
20962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
20963 LDKClosingSignedFeeRange o_conv;
20964 o_conv.inner = (void*)(o & (~1));
20965 o_conv.is_owned = (o & 1) || (o == 0);
20966 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20967 o_conv = ClosingSignedFeeRange_clone(&o_conv);
20968 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20969 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
20970 return (int64_t)ret_conv;
20973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
20974 LDKDecodeError e_conv;
20975 e_conv.inner = (void*)(e & (~1));
20976 e_conv.is_owned = (e & 1) || (e == 0);
20977 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20978 e_conv = DecodeError_clone(&e_conv);
20979 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
20980 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
20981 return (int64_t)ret_conv;
20984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
20985 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(o & ~1);
20986 jboolean ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
20990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
20991 if ((_res & 1) != 0) return;
20992 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
20993 CHECK_ACCESS(_res_ptr);
20994 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
20996 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
20999 static inline uintptr_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
21000 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21001 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
21002 return (int64_t)ret_conv;
21004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21005 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
21006 int64_t ret_val = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
21010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21011 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
21012 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21013 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
21014 return (int64_t)ret_conv;
21017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21018 LDKCommitmentSigned o_conv;
21019 o_conv.inner = (void*)(o & (~1));
21020 o_conv.is_owned = (o & 1) || (o == 0);
21021 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21022 o_conv = CommitmentSigned_clone(&o_conv);
21023 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21024 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
21025 return (int64_t)ret_conv;
21028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21029 LDKDecodeError e_conv;
21030 e_conv.inner = (void*)(e & (~1));
21031 e_conv.is_owned = (e & 1) || (e == 0);
21032 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21033 e_conv = DecodeError_clone(&e_conv);
21034 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21035 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
21036 return (int64_t)ret_conv;
21039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21040 LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(o & ~1);
21041 jboolean ret_val = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
21045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21046 if ((_res & 1) != 0) return;
21047 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21048 CHECK_ACCESS(_res_ptr);
21049 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
21051 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
21054 static inline uintptr_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
21055 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21056 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
21057 return (int64_t)ret_conv;
21059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21060 LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
21061 int64_t ret_val = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
21065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21066 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
21067 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21068 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
21069 return (int64_t)ret_conv;
21072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21073 LDKFundingCreated o_conv;
21074 o_conv.inner = (void*)(o & (~1));
21075 o_conv.is_owned = (o & 1) || (o == 0);
21076 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21077 o_conv = FundingCreated_clone(&o_conv);
21078 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21079 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
21080 return (int64_t)ret_conv;
21083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21084 LDKDecodeError e_conv;
21085 e_conv.inner = (void*)(e & (~1));
21086 e_conv.is_owned = (e & 1) || (e == 0);
21087 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21088 e_conv = DecodeError_clone(&e_conv);
21089 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21090 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
21091 return (int64_t)ret_conv;
21094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21095 LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(o & ~1);
21096 jboolean ret_val = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
21100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21101 if ((_res & 1) != 0) return;
21102 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21103 CHECK_ACCESS(_res_ptr);
21104 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
21106 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
21109 static inline uintptr_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
21110 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21111 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
21112 return (int64_t)ret_conv;
21114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21115 LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
21116 int64_t ret_val = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
21120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21121 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
21122 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21123 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
21124 return (int64_t)ret_conv;
21127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21128 LDKFundingSigned o_conv;
21129 o_conv.inner = (void*)(o & (~1));
21130 o_conv.is_owned = (o & 1) || (o == 0);
21131 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21132 o_conv = FundingSigned_clone(&o_conv);
21133 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21134 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
21135 return (int64_t)ret_conv;
21138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21139 LDKDecodeError e_conv;
21140 e_conv.inner = (void*)(e & (~1));
21141 e_conv.is_owned = (e & 1) || (e == 0);
21142 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21143 e_conv = DecodeError_clone(&e_conv);
21144 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21145 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
21146 return (int64_t)ret_conv;
21149 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21150 LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(o & ~1);
21151 jboolean ret_val = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
21155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21156 if ((_res & 1) != 0) return;
21157 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21158 CHECK_ACCESS(_res_ptr);
21159 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
21161 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
21164 static inline uintptr_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
21165 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21166 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
21167 return (int64_t)ret_conv;
21169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21170 LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
21171 int64_t ret_val = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
21175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21176 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
21177 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21178 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
21179 return (int64_t)ret_conv;
21182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21183 LDKFundingLocked o_conv;
21184 o_conv.inner = (void*)(o & (~1));
21185 o_conv.is_owned = (o & 1) || (o == 0);
21186 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21187 o_conv = FundingLocked_clone(&o_conv);
21188 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21189 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
21190 return (int64_t)ret_conv;
21193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21194 LDKDecodeError e_conv;
21195 e_conv.inner = (void*)(e & (~1));
21196 e_conv.is_owned = (e & 1) || (e == 0);
21197 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21198 e_conv = DecodeError_clone(&e_conv);
21199 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21200 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
21201 return (int64_t)ret_conv;
21204 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21205 LDKCResult_FundingLockedDecodeErrorZ* o_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(o & ~1);
21206 jboolean ret_val = CResult_FundingLockedDecodeErrorZ_is_ok(o_conv);
21210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21211 if ((_res & 1) != 0) return;
21212 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21213 CHECK_ACCESS(_res_ptr);
21214 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(_res_ptr);
21216 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
21219 static inline uintptr_t CResult_FundingLockedDecodeErrorZ_clone_ptr(LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR arg) {
21220 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21221 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(arg);
21222 return (int64_t)ret_conv;
21224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21225 LDKCResult_FundingLockedDecodeErrorZ* arg_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
21226 int64_t ret_val = CResult_FundingLockedDecodeErrorZ_clone_ptr(arg_conv);
21230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21231 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
21232 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21233 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
21234 return (int64_t)ret_conv;
21237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21239 o_conv.inner = (void*)(o & (~1));
21240 o_conv.is_owned = (o & 1) || (o == 0);
21241 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21242 o_conv = Init_clone(&o_conv);
21243 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21244 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
21245 return (int64_t)ret_conv;
21248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21249 LDKDecodeError e_conv;
21250 e_conv.inner = (void*)(e & (~1));
21251 e_conv.is_owned = (e & 1) || (e == 0);
21252 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21253 e_conv = DecodeError_clone(&e_conv);
21254 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21255 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
21256 return (int64_t)ret_conv;
21259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21260 LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)(o & ~1);
21261 jboolean ret_val = CResult_InitDecodeErrorZ_is_ok(o_conv);
21265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21266 if ((_res & 1) != 0) return;
21267 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21268 CHECK_ACCESS(_res_ptr);
21269 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
21271 CResult_InitDecodeErrorZ_free(_res_conv);
21274 static inline uintptr_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
21275 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21276 *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
21277 return (int64_t)ret_conv;
21279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21280 LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
21281 int64_t ret_val = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
21285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21286 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
21287 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21288 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
21289 return (int64_t)ret_conv;
21292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21293 LDKOpenChannel o_conv;
21294 o_conv.inner = (void*)(o & (~1));
21295 o_conv.is_owned = (o & 1) || (o == 0);
21296 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21297 o_conv = OpenChannel_clone(&o_conv);
21298 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21299 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
21300 return (int64_t)ret_conv;
21303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21304 LDKDecodeError e_conv;
21305 e_conv.inner = (void*)(e & (~1));
21306 e_conv.is_owned = (e & 1) || (e == 0);
21307 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21308 e_conv = DecodeError_clone(&e_conv);
21309 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21310 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
21311 return (int64_t)ret_conv;
21314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21315 LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(o & ~1);
21316 jboolean ret_val = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
21320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21321 if ((_res & 1) != 0) return;
21322 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21323 CHECK_ACCESS(_res_ptr);
21324 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
21326 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
21329 static inline uintptr_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
21330 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21331 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
21332 return (int64_t)ret_conv;
21334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21335 LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
21336 int64_t ret_val = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
21340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21341 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
21342 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21343 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
21344 return (int64_t)ret_conv;
21347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21348 LDKRevokeAndACK o_conv;
21349 o_conv.inner = (void*)(o & (~1));
21350 o_conv.is_owned = (o & 1) || (o == 0);
21351 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21352 o_conv = RevokeAndACK_clone(&o_conv);
21353 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21354 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
21355 return (int64_t)ret_conv;
21358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21359 LDKDecodeError e_conv;
21360 e_conv.inner = (void*)(e & (~1));
21361 e_conv.is_owned = (e & 1) || (e == 0);
21362 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21363 e_conv = DecodeError_clone(&e_conv);
21364 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21365 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
21366 return (int64_t)ret_conv;
21369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21370 LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(o & ~1);
21371 jboolean ret_val = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
21375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21376 if ((_res & 1) != 0) return;
21377 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21378 CHECK_ACCESS(_res_ptr);
21379 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
21381 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
21384 static inline uintptr_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
21385 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21386 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
21387 return (int64_t)ret_conv;
21389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21390 LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
21391 int64_t ret_val = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
21395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21396 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
21397 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21398 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
21399 return (int64_t)ret_conv;
21402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21403 LDKShutdown o_conv;
21404 o_conv.inner = (void*)(o & (~1));
21405 o_conv.is_owned = (o & 1) || (o == 0);
21406 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21407 o_conv = Shutdown_clone(&o_conv);
21408 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21409 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
21410 return (int64_t)ret_conv;
21413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21414 LDKDecodeError e_conv;
21415 e_conv.inner = (void*)(e & (~1));
21416 e_conv.is_owned = (e & 1) || (e == 0);
21417 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21418 e_conv = DecodeError_clone(&e_conv);
21419 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21420 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
21421 return (int64_t)ret_conv;
21424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21425 LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)(o & ~1);
21426 jboolean ret_val = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
21430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21431 if ((_res & 1) != 0) return;
21432 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21433 CHECK_ACCESS(_res_ptr);
21434 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
21436 CResult_ShutdownDecodeErrorZ_free(_res_conv);
21439 static inline uintptr_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
21440 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21441 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
21442 return (int64_t)ret_conv;
21444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21445 LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
21446 int64_t ret_val = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
21450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21451 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
21452 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21453 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
21454 return (int64_t)ret_conv;
21457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21458 LDKUpdateFailHTLC o_conv;
21459 o_conv.inner = (void*)(o & (~1));
21460 o_conv.is_owned = (o & 1) || (o == 0);
21461 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21462 o_conv = UpdateFailHTLC_clone(&o_conv);
21463 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21464 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
21465 return (int64_t)ret_conv;
21468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21469 LDKDecodeError e_conv;
21470 e_conv.inner = (void*)(e & (~1));
21471 e_conv.is_owned = (e & 1) || (e == 0);
21472 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21473 e_conv = DecodeError_clone(&e_conv);
21474 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21475 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
21476 return (int64_t)ret_conv;
21479 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21480 LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(o & ~1);
21481 jboolean ret_val = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
21485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21486 if ((_res & 1) != 0) return;
21487 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21488 CHECK_ACCESS(_res_ptr);
21489 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
21491 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
21494 static inline uintptr_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
21495 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21496 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
21497 return (int64_t)ret_conv;
21499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21500 LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
21501 int64_t ret_val = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
21505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21506 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
21507 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21508 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
21509 return (int64_t)ret_conv;
21512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21513 LDKUpdateFailMalformedHTLC o_conv;
21514 o_conv.inner = (void*)(o & (~1));
21515 o_conv.is_owned = (o & 1) || (o == 0);
21516 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21517 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
21518 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21519 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
21520 return (int64_t)ret_conv;
21523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21524 LDKDecodeError e_conv;
21525 e_conv.inner = (void*)(e & (~1));
21526 e_conv.is_owned = (e & 1) || (e == 0);
21527 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21528 e_conv = DecodeError_clone(&e_conv);
21529 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21530 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
21531 return (int64_t)ret_conv;
21534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21535 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(o & ~1);
21536 jboolean ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
21540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21541 if ((_res & 1) != 0) return;
21542 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21543 CHECK_ACCESS(_res_ptr);
21544 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
21546 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
21549 static inline uintptr_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
21550 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21551 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
21552 return (int64_t)ret_conv;
21554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21555 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
21556 int64_t ret_val = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
21560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21561 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
21562 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21563 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
21564 return (int64_t)ret_conv;
21567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21568 LDKUpdateFee o_conv;
21569 o_conv.inner = (void*)(o & (~1));
21570 o_conv.is_owned = (o & 1) || (o == 0);
21571 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21572 o_conv = UpdateFee_clone(&o_conv);
21573 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21574 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
21575 return (int64_t)ret_conv;
21578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21579 LDKDecodeError e_conv;
21580 e_conv.inner = (void*)(e & (~1));
21581 e_conv.is_owned = (e & 1) || (e == 0);
21582 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21583 e_conv = DecodeError_clone(&e_conv);
21584 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21585 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
21586 return (int64_t)ret_conv;
21589 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21590 LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(o & ~1);
21591 jboolean ret_val = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
21595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21596 if ((_res & 1) != 0) return;
21597 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21598 CHECK_ACCESS(_res_ptr);
21599 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
21601 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
21604 static inline uintptr_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
21605 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21606 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
21607 return (int64_t)ret_conv;
21609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21610 LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
21611 int64_t ret_val = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
21615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21616 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
21617 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21618 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
21619 return (int64_t)ret_conv;
21622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21623 LDKUpdateFulfillHTLC o_conv;
21624 o_conv.inner = (void*)(o & (~1));
21625 o_conv.is_owned = (o & 1) || (o == 0);
21626 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21627 o_conv = UpdateFulfillHTLC_clone(&o_conv);
21628 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21629 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
21630 return (int64_t)ret_conv;
21633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21634 LDKDecodeError e_conv;
21635 e_conv.inner = (void*)(e & (~1));
21636 e_conv.is_owned = (e & 1) || (e == 0);
21637 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21638 e_conv = DecodeError_clone(&e_conv);
21639 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21640 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
21641 return (int64_t)ret_conv;
21644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21645 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(o & ~1);
21646 jboolean ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
21650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21651 if ((_res & 1) != 0) return;
21652 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21653 CHECK_ACCESS(_res_ptr);
21654 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
21656 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
21659 static inline uintptr_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
21660 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21661 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
21662 return (int64_t)ret_conv;
21664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21665 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
21666 int64_t ret_val = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
21670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21671 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
21672 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21673 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
21674 return (int64_t)ret_conv;
21677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21678 LDKUpdateAddHTLC o_conv;
21679 o_conv.inner = (void*)(o & (~1));
21680 o_conv.is_owned = (o & 1) || (o == 0);
21681 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21682 o_conv = UpdateAddHTLC_clone(&o_conv);
21683 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21684 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
21685 return (int64_t)ret_conv;
21688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21689 LDKDecodeError e_conv;
21690 e_conv.inner = (void*)(e & (~1));
21691 e_conv.is_owned = (e & 1) || (e == 0);
21692 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21693 e_conv = DecodeError_clone(&e_conv);
21694 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21695 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
21696 return (int64_t)ret_conv;
21699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21700 LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(o & ~1);
21701 jboolean ret_val = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
21705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21706 if ((_res & 1) != 0) return;
21707 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21708 CHECK_ACCESS(_res_ptr);
21709 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
21711 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
21714 static inline uintptr_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
21715 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21716 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
21717 return (int64_t)ret_conv;
21719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21720 LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
21721 int64_t ret_val = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
21725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21726 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
21727 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21728 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
21729 return (int64_t)ret_conv;
21732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21734 o_conv.inner = (void*)(o & (~1));
21735 o_conv.is_owned = (o & 1) || (o == 0);
21736 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21737 o_conv = Ping_clone(&o_conv);
21738 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21739 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
21740 return (int64_t)ret_conv;
21743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21744 LDKDecodeError e_conv;
21745 e_conv.inner = (void*)(e & (~1));
21746 e_conv.is_owned = (e & 1) || (e == 0);
21747 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21748 e_conv = DecodeError_clone(&e_conv);
21749 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21750 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
21751 return (int64_t)ret_conv;
21754 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21755 LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)(o & ~1);
21756 jboolean ret_val = CResult_PingDecodeErrorZ_is_ok(o_conv);
21760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21761 if ((_res & 1) != 0) return;
21762 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21763 CHECK_ACCESS(_res_ptr);
21764 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
21766 CResult_PingDecodeErrorZ_free(_res_conv);
21769 static inline uintptr_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
21770 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21771 *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
21772 return (int64_t)ret_conv;
21774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21775 LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
21776 int64_t ret_val = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
21780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21781 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
21782 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21783 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
21784 return (int64_t)ret_conv;
21787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21789 o_conv.inner = (void*)(o & (~1));
21790 o_conv.is_owned = (o & 1) || (o == 0);
21791 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21792 o_conv = Pong_clone(&o_conv);
21793 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21794 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
21795 return (int64_t)ret_conv;
21798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21799 LDKDecodeError e_conv;
21800 e_conv.inner = (void*)(e & (~1));
21801 e_conv.is_owned = (e & 1) || (e == 0);
21802 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21803 e_conv = DecodeError_clone(&e_conv);
21804 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21805 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
21806 return (int64_t)ret_conv;
21809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21810 LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)(o & ~1);
21811 jboolean ret_val = CResult_PongDecodeErrorZ_is_ok(o_conv);
21815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21816 if ((_res & 1) != 0) return;
21817 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21818 CHECK_ACCESS(_res_ptr);
21819 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
21821 CResult_PongDecodeErrorZ_free(_res_conv);
21824 static inline uintptr_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
21825 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21826 *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
21827 return (int64_t)ret_conv;
21829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21830 LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
21831 int64_t ret_val = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
21835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21836 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
21837 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21838 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
21839 return (int64_t)ret_conv;
21842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21843 LDKUnsignedChannelAnnouncement o_conv;
21844 o_conv.inner = (void*)(o & (~1));
21845 o_conv.is_owned = (o & 1) || (o == 0);
21846 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21847 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
21848 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21849 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
21850 return (int64_t)ret_conv;
21853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21854 LDKDecodeError e_conv;
21855 e_conv.inner = (void*)(e & (~1));
21856 e_conv.is_owned = (e & 1) || (e == 0);
21857 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21858 e_conv = DecodeError_clone(&e_conv);
21859 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21860 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
21861 return (int64_t)ret_conv;
21864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21865 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(o & ~1);
21866 jboolean ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21871 if ((_res & 1) != 0) return;
21872 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21873 CHECK_ACCESS(_res_ptr);
21874 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21876 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
21879 static inline uintptr_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21880 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21881 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
21882 return (int64_t)ret_conv;
21884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21885 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
21886 int64_t ret_val = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21891 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
21892 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21893 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21894 return (int64_t)ret_conv;
21897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21898 LDKChannelAnnouncement o_conv;
21899 o_conv.inner = (void*)(o & (~1));
21900 o_conv.is_owned = (o & 1) || (o == 0);
21901 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21902 o_conv = ChannelAnnouncement_clone(&o_conv);
21903 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21904 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
21905 return (int64_t)ret_conv;
21908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21909 LDKDecodeError e_conv;
21910 e_conv.inner = (void*)(e & (~1));
21911 e_conv.is_owned = (e & 1) || (e == 0);
21912 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21913 e_conv = DecodeError_clone(&e_conv);
21914 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21915 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
21916 return (int64_t)ret_conv;
21919 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21920 LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(o & ~1);
21921 jboolean ret_val = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
21925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21926 if ((_res & 1) != 0) return;
21927 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21928 CHECK_ACCESS(_res_ptr);
21929 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
21931 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
21934 static inline uintptr_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21935 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21936 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
21937 return (int64_t)ret_conv;
21939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21940 LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
21941 int64_t ret_val = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21946 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
21947 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21948 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
21949 return (int64_t)ret_conv;
21952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
21953 LDKUnsignedChannelUpdate o_conv;
21954 o_conv.inner = (void*)(o & (~1));
21955 o_conv.is_owned = (o & 1) || (o == 0);
21956 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21957 o_conv = UnsignedChannelUpdate_clone(&o_conv);
21958 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21959 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
21960 return (int64_t)ret_conv;
21963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
21964 LDKDecodeError e_conv;
21965 e_conv.inner = (void*)(e & (~1));
21966 e_conv.is_owned = (e & 1) || (e == 0);
21967 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
21968 e_conv = DecodeError_clone(&e_conv);
21969 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21970 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
21971 return (int64_t)ret_conv;
21974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
21975 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(o & ~1);
21976 jboolean ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
21980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
21981 if ((_res & 1) != 0) return;
21982 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
21983 CHECK_ACCESS(_res_ptr);
21984 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
21986 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
21989 static inline uintptr_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
21990 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21991 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
21992 return (int64_t)ret_conv;
21994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
21995 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
21996 int64_t ret_val = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22001 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
22002 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22003 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
22004 return (int64_t)ret_conv;
22007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22008 LDKChannelUpdate o_conv;
22009 o_conv.inner = (void*)(o & (~1));
22010 o_conv.is_owned = (o & 1) || (o == 0);
22011 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22012 o_conv = ChannelUpdate_clone(&o_conv);
22013 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22014 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
22015 return (int64_t)ret_conv;
22018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22019 LDKDecodeError e_conv;
22020 e_conv.inner = (void*)(e & (~1));
22021 e_conv.is_owned = (e & 1) || (e == 0);
22022 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22023 e_conv = DecodeError_clone(&e_conv);
22024 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22025 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
22026 return (int64_t)ret_conv;
22029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22030 LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(o & ~1);
22031 jboolean ret_val = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
22035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22036 if ((_res & 1) != 0) return;
22037 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22038 CHECK_ACCESS(_res_ptr);
22039 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
22041 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
22044 static inline uintptr_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
22045 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22046 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
22047 return (int64_t)ret_conv;
22049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22050 LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
22051 int64_t ret_val = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
22055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22056 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
22057 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22058 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
22059 return (int64_t)ret_conv;
22062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22063 LDKErrorMessage o_conv;
22064 o_conv.inner = (void*)(o & (~1));
22065 o_conv.is_owned = (o & 1) || (o == 0);
22066 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22067 o_conv = ErrorMessage_clone(&o_conv);
22068 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22069 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
22070 return (int64_t)ret_conv;
22073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22074 LDKDecodeError e_conv;
22075 e_conv.inner = (void*)(e & (~1));
22076 e_conv.is_owned = (e & 1) || (e == 0);
22077 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22078 e_conv = DecodeError_clone(&e_conv);
22079 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22080 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
22081 return (int64_t)ret_conv;
22084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22085 LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(o & ~1);
22086 jboolean ret_val = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
22090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22091 if ((_res & 1) != 0) return;
22092 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22093 CHECK_ACCESS(_res_ptr);
22094 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
22096 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
22099 static inline uintptr_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
22100 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22101 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
22102 return (int64_t)ret_conv;
22104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22105 LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
22106 int64_t ret_val = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
22110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22111 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
22112 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22113 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
22114 return (int64_t)ret_conv;
22117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22118 LDKWarningMessage o_conv;
22119 o_conv.inner = (void*)(o & (~1));
22120 o_conv.is_owned = (o & 1) || (o == 0);
22121 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22122 o_conv = WarningMessage_clone(&o_conv);
22123 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22124 *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
22125 return (int64_t)ret_conv;
22128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22129 LDKDecodeError e_conv;
22130 e_conv.inner = (void*)(e & (~1));
22131 e_conv.is_owned = (e & 1) || (e == 0);
22132 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22133 e_conv = DecodeError_clone(&e_conv);
22134 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22135 *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
22136 return (int64_t)ret_conv;
22139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22140 LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(o & ~1);
22141 jboolean ret_val = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
22145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22146 if ((_res & 1) != 0) return;
22147 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22148 CHECK_ACCESS(_res_ptr);
22149 LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
22151 CResult_WarningMessageDecodeErrorZ_free(_res_conv);
22154 static inline uintptr_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
22155 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22156 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
22157 return (int64_t)ret_conv;
22159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22160 LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(arg & ~1);
22161 int64_t ret_val = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
22165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22166 LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)(orig & ~1);
22167 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
22168 *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
22169 return (int64_t)ret_conv;
22172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22173 LDKUnsignedNodeAnnouncement o_conv;
22174 o_conv.inner = (void*)(o & (~1));
22175 o_conv.is_owned = (o & 1) || (o == 0);
22176 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22177 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
22178 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22179 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
22180 return (int64_t)ret_conv;
22183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22184 LDKDecodeError e_conv;
22185 e_conv.inner = (void*)(e & (~1));
22186 e_conv.is_owned = (e & 1) || (e == 0);
22187 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22188 e_conv = DecodeError_clone(&e_conv);
22189 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22190 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
22191 return (int64_t)ret_conv;
22194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22195 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(o & ~1);
22196 jboolean ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22201 if ((_res & 1) != 0) return;
22202 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22203 CHECK_ACCESS(_res_ptr);
22204 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
22206 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
22209 static inline uintptr_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22210 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22211 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
22212 return (int64_t)ret_conv;
22214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22215 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
22216 int64_t ret_val = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22221 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
22222 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22223 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
22224 return (int64_t)ret_conv;
22227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22228 LDKNodeAnnouncement o_conv;
22229 o_conv.inner = (void*)(o & (~1));
22230 o_conv.is_owned = (o & 1) || (o == 0);
22231 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22232 o_conv = NodeAnnouncement_clone(&o_conv);
22233 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22234 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
22235 return (int64_t)ret_conv;
22238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22239 LDKDecodeError e_conv;
22240 e_conv.inner = (void*)(e & (~1));
22241 e_conv.is_owned = (e & 1) || (e == 0);
22242 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22243 e_conv = DecodeError_clone(&e_conv);
22244 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22245 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
22246 return (int64_t)ret_conv;
22249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22250 LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(o & ~1);
22251 jboolean ret_val = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
22255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22256 if ((_res & 1) != 0) return;
22257 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22258 CHECK_ACCESS(_res_ptr);
22259 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
22261 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
22264 static inline uintptr_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
22265 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22266 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
22267 return (int64_t)ret_conv;
22269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22270 LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
22271 int64_t ret_val = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
22275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22276 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
22277 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22278 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
22279 return (int64_t)ret_conv;
22282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22283 LDKQueryShortChannelIds o_conv;
22284 o_conv.inner = (void*)(o & (~1));
22285 o_conv.is_owned = (o & 1) || (o == 0);
22286 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22287 o_conv = QueryShortChannelIds_clone(&o_conv);
22288 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22289 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
22290 return (int64_t)ret_conv;
22293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22294 LDKDecodeError e_conv;
22295 e_conv.inner = (void*)(e & (~1));
22296 e_conv.is_owned = (e & 1) || (e == 0);
22297 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22298 e_conv = DecodeError_clone(&e_conv);
22299 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22300 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
22301 return (int64_t)ret_conv;
22304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22305 LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(o & ~1);
22306 jboolean ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
22310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22311 if ((_res & 1) != 0) return;
22312 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22313 CHECK_ACCESS(_res_ptr);
22314 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
22316 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
22319 static inline uintptr_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
22320 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22321 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
22322 return (int64_t)ret_conv;
22324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22325 LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
22326 int64_t ret_val = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
22330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22331 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
22332 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22333 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
22334 return (int64_t)ret_conv;
22337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22338 LDKReplyShortChannelIdsEnd o_conv;
22339 o_conv.inner = (void*)(o & (~1));
22340 o_conv.is_owned = (o & 1) || (o == 0);
22341 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22342 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
22343 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22344 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
22345 return (int64_t)ret_conv;
22348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22349 LDKDecodeError e_conv;
22350 e_conv.inner = (void*)(e & (~1));
22351 e_conv.is_owned = (e & 1) || (e == 0);
22352 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22353 e_conv = DecodeError_clone(&e_conv);
22354 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22355 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
22356 return (int64_t)ret_conv;
22359 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22360 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(o & ~1);
22361 jboolean ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
22365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22366 if ((_res & 1) != 0) return;
22367 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22368 CHECK_ACCESS(_res_ptr);
22369 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
22371 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
22374 static inline uintptr_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
22375 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22376 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
22377 return (int64_t)ret_conv;
22379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22380 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
22381 int64_t ret_val = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
22385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22386 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
22387 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22388 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
22389 return (int64_t)ret_conv;
22392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22393 LDKQueryChannelRange o_conv;
22394 o_conv.inner = (void*)(o & (~1));
22395 o_conv.is_owned = (o & 1) || (o == 0);
22396 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22397 o_conv = QueryChannelRange_clone(&o_conv);
22398 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22399 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
22400 return (int64_t)ret_conv;
22403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22404 LDKDecodeError e_conv;
22405 e_conv.inner = (void*)(e & (~1));
22406 e_conv.is_owned = (e & 1) || (e == 0);
22407 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22408 e_conv = DecodeError_clone(&e_conv);
22409 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22410 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
22411 return (int64_t)ret_conv;
22414 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22415 LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(o & ~1);
22416 jboolean ret_val = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
22420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22421 if ((_res & 1) != 0) return;
22422 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22423 CHECK_ACCESS(_res_ptr);
22424 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
22426 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
22429 static inline uintptr_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22430 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22431 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
22432 return (int64_t)ret_conv;
22434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22435 LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
22436 int64_t ret_val = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22441 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
22442 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22443 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
22444 return (int64_t)ret_conv;
22447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22448 LDKReplyChannelRange o_conv;
22449 o_conv.inner = (void*)(o & (~1));
22450 o_conv.is_owned = (o & 1) || (o == 0);
22451 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22452 o_conv = ReplyChannelRange_clone(&o_conv);
22453 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22454 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
22455 return (int64_t)ret_conv;
22458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22459 LDKDecodeError e_conv;
22460 e_conv.inner = (void*)(e & (~1));
22461 e_conv.is_owned = (e & 1) || (e == 0);
22462 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22463 e_conv = DecodeError_clone(&e_conv);
22464 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22465 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
22466 return (int64_t)ret_conv;
22469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22470 LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(o & ~1);
22471 jboolean ret_val = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
22475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22476 if ((_res & 1) != 0) return;
22477 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22478 CHECK_ACCESS(_res_ptr);
22479 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
22481 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
22484 static inline uintptr_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
22485 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22486 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
22487 return (int64_t)ret_conv;
22489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22490 LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
22491 int64_t ret_val = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
22495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22496 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
22497 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22498 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
22499 return (int64_t)ret_conv;
22502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22503 LDKGossipTimestampFilter o_conv;
22504 o_conv.inner = (void*)(o & (~1));
22505 o_conv.is_owned = (o & 1) || (o == 0);
22506 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22507 o_conv = GossipTimestampFilter_clone(&o_conv);
22508 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22509 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
22510 return (int64_t)ret_conv;
22513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22514 LDKDecodeError e_conv;
22515 e_conv.inner = (void*)(e & (~1));
22516 e_conv.is_owned = (e & 1) || (e == 0);
22517 CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
22518 e_conv = DecodeError_clone(&e_conv);
22519 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22520 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
22521 return (int64_t)ret_conv;
22524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22525 LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(o & ~1);
22526 jboolean ret_val = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
22530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22531 if ((_res & 1) != 0) return;
22532 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22533 CHECK_ACCESS(_res_ptr);
22534 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
22536 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
22539 static inline uintptr_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
22540 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22541 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
22542 return (int64_t)ret_conv;
22544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22545 LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
22546 int64_t ret_val = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
22550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22551 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
22552 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22553 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
22554 return (int64_t)ret_conv;
22557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22558 LDKCVec_PhantomRouteHintsZ _res_constr;
22559 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22560 if (_res_constr.datalen > 0)
22561 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
22563 _res_constr.data = NULL;
22564 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22565 for (size_t t = 0; t < _res_constr.datalen; t++) {
22566 int64_t _res_conv_19 = _res_vals[t];
22567 LDKPhantomRouteHints _res_conv_19_conv;
22568 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
22569 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
22570 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
22571 _res_constr.data[t] = _res_conv_19_conv;
22573 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22574 CVec_PhantomRouteHintsZ_free(_res_constr);
22577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22579 o_conv.inner = (void*)(o & (~1));
22580 o_conv.is_owned = (o & 1) || (o == 0);
22581 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22582 o_conv = Invoice_clone(&o_conv);
22583 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22584 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
22585 return (int64_t)ret_conv;
22588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
22589 void* e_ptr = (void*)(((uintptr_t)e) & ~1);
22590 CHECK_ACCESS(e_ptr);
22591 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
22592 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uintptr_t)e) & ~1));
22593 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22594 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
22595 return (int64_t)ret_conv;
22598 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22599 LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(o & ~1);
22600 jboolean ret_val = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
22604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22605 if ((_res & 1) != 0) return;
22606 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22607 CHECK_ACCESS(_res_ptr);
22608 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
22610 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
22613 static inline uintptr_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
22614 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22615 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
22616 return (int64_t)ret_conv;
22618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22619 LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
22620 int64_t ret_val = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
22624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22625 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
22626 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
22627 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
22628 return (int64_t)ret_conv;
22631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
22632 void* o_ptr = (void*)(((uintptr_t)o) & ~1);
22633 CHECK_ACCESS(o_ptr);
22634 LDKFilter o_conv = *(LDKFilter*)(o_ptr);
22635 if (o_conv.free == LDKFilter_JCalls_free) {
22636 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22637 LDKFilter_JCalls_cloned(&o_conv);
22639 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
22640 *ret_copy = COption_FilterZ_some(o_conv);
22641 int64_t ret_ref = (uintptr_t)ret_copy;
22645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
22646 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
22647 *ret_copy = COption_FilterZ_none();
22648 int64_t ret_ref = (uintptr_t)ret_copy;
22652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22653 if ((_res & 1) != 0) return;
22654 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22655 CHECK_ACCESS(_res_ptr);
22656 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
22658 COption_FilterZ_free(_res_conv);
22661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
22662 LDKLockedChannelMonitor o_conv;
22663 o_conv.inner = (void*)(o & (~1));
22664 o_conv.is_owned = (o & 1) || (o == 0);
22665 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22666 // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
22667 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22668 *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
22669 return (int64_t)ret_conv;
22672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
22673 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
22674 *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
22675 return (int64_t)ret_conv;
22678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
22679 LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)(o & ~1);
22680 jboolean ret_val = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
22684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
22685 if ((_res & 1) != 0) return;
22686 void* _res_ptr = (void*)(((uintptr_t)_res) & ~1);
22687 CHECK_ACCESS(_res_ptr);
22688 LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
22690 CResult_LockedChannelMonitorNoneZ_free(_res_conv);
22693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
22694 LDKCVec_OutPointZ _res_constr;
22695 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
22696 if (_res_constr.datalen > 0)
22697 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
22699 _res_constr.data = NULL;
22700 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
22701 for (size_t k = 0; k < _res_constr.datalen; k++) {
22702 int64_t _res_conv_10 = _res_vals[k];
22703 LDKOutPoint _res_conv_10_conv;
22704 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
22705 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
22706 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
22707 _res_constr.data[k] = _res_conv_10_conv;
22709 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
22710 CVec_OutPointZ_free(_res_constr);
22713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22714 if ((this_ptr & 1) != 0) return;
22715 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22716 CHECK_ACCESS(this_ptr_ptr);
22717 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
22718 FREE((void*)this_ptr);
22719 PaymentPurpose_free(this_ptr_conv);
22722 static inline uintptr_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
22723 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
22724 *ret_copy = PaymentPurpose_clone(arg);
22725 int64_t ret_ref = (uintptr_t)ret_copy;
22728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22729 LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)arg;
22730 int64_t ret_val = PaymentPurpose_clone_ptr(arg_conv);
22734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22735 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
22736 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
22737 *ret_copy = PaymentPurpose_clone(orig_conv);
22738 int64_t ret_ref = (uintptr_t)ret_copy;
22742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) {
22743 LDKThirtyTwoBytes payment_preimage_ref;
22744 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
22745 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
22746 LDKThirtyTwoBytes payment_secret_ref;
22747 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
22748 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
22749 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
22750 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
22751 int64_t ret_ref = (uintptr_t)ret_copy;
22755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
22756 LDKThirtyTwoBytes a_ref;
22757 CHECK((*env)->GetArrayLength(env, a) == 32);
22758 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
22759 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
22760 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
22761 int64_t ret_ref = (uintptr_t)ret_copy;
22765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22766 if ((this_ptr & 1) != 0) return;
22767 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22768 CHECK_ACCESS(this_ptr_ptr);
22769 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
22770 FREE((void*)this_ptr);
22771 ClosureReason_free(this_ptr_conv);
22774 static inline uintptr_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
22775 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22776 *ret_copy = ClosureReason_clone(arg);
22777 int64_t ret_ref = (uintptr_t)ret_copy;
22780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22781 LDKClosureReason* arg_conv = (LDKClosureReason*)arg;
22782 int64_t ret_val = ClosureReason_clone_ptr(arg_conv);
22786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22787 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
22788 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22789 *ret_copy = ClosureReason_clone(orig_conv);
22790 int64_t ret_ref = (uintptr_t)ret_copy;
22794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
22795 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
22796 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22797 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
22798 int64_t ret_ref = (uintptr_t)ret_copy;
22802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
22803 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22804 *ret_copy = ClosureReason_holder_force_closed();
22805 int64_t ret_ref = (uintptr_t)ret_copy;
22809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
22810 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22811 *ret_copy = ClosureReason_cooperative_closure();
22812 int64_t ret_ref = (uintptr_t)ret_copy;
22816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
22817 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22818 *ret_copy = ClosureReason_commitment_tx_confirmed();
22819 int64_t ret_ref = (uintptr_t)ret_copy;
22823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
22824 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22825 *ret_copy = ClosureReason_funding_timed_out();
22826 int64_t ret_ref = (uintptr_t)ret_copy;
22830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
22831 LDKStr err_conv = java_to_owned_str(env, err);
22832 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22833 *ret_copy = ClosureReason_processing_error(err_conv);
22834 int64_t ret_ref = (uintptr_t)ret_copy;
22838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
22839 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22840 *ret_copy = ClosureReason_disconnected_peer();
22841 int64_t ret_ref = (uintptr_t)ret_copy;
22845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
22846 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
22847 *ret_copy = ClosureReason_outdated_channel_manager();
22848 int64_t ret_ref = (uintptr_t)ret_copy;
22852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
22853 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
22854 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
22855 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22856 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22857 CVec_u8Z_free(ret_var);
22861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22862 LDKu8slice ser_ref;
22863 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22864 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22865 LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
22866 *ret_conv = ClosureReason_read(ser_ref);
22867 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22868 return (int64_t)ret_conv;
22871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22872 if ((this_ptr & 1) != 0) return;
22873 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
22874 CHECK_ACCESS(this_ptr_ptr);
22875 LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
22876 FREE((void*)this_ptr);
22877 Event_free(this_ptr_conv);
22880 static inline uintptr_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
22881 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22882 *ret_copy = Event_clone(arg);
22883 int64_t ret_ref = (uintptr_t)ret_copy;
22886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
22887 LDKEvent* arg_conv = (LDKEvent*)arg;
22888 int64_t ret_val = Event_clone_ptr(arg_conv);
22892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22893 LDKEvent* orig_conv = (LDKEvent*)orig;
22894 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22895 *ret_copy = Event_clone(orig_conv);
22896 int64_t ret_ref = (uintptr_t)ret_copy;
22900 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) {
22901 LDKThirtyTwoBytes temporary_channel_id_ref;
22902 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
22903 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
22904 LDKCVec_u8Z output_script_ref;
22905 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
22906 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
22907 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
22908 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22909 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
22910 int64_t ret_ref = (uintptr_t)ret_copy;
22914 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) {
22915 LDKThirtyTwoBytes payment_hash_ref;
22916 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
22917 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
22918 void* purpose_ptr = (void*)(((uintptr_t)purpose) & ~1);
22919 CHECK_ACCESS(purpose_ptr);
22920 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
22921 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uintptr_t)purpose) & ~1));
22922 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22923 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
22924 int64_t ret_ref = (uintptr_t)ret_copy;
22928 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) {
22929 LDKThirtyTwoBytes payment_id_ref;
22930 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
22931 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
22932 LDKThirtyTwoBytes payment_preimage_ref;
22933 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
22934 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
22935 LDKThirtyTwoBytes payment_hash_ref;
22936 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
22937 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
22938 void* fee_paid_msat_ptr = (void*)(((uintptr_t)fee_paid_msat) & ~1);
22939 CHECK_ACCESS(fee_paid_msat_ptr);
22940 LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
22941 fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_paid_msat) & ~1));
22942 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22943 *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
22944 int64_t ret_ref = (uintptr_t)ret_copy;
22948 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) {
22949 LDKThirtyTwoBytes payment_id_ref;
22950 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
22951 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
22952 LDKThirtyTwoBytes payment_hash_ref;
22953 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
22954 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
22955 void* network_update_ptr = (void*)(((uintptr_t)network_update) & ~1);
22956 CHECK_ACCESS(network_update_ptr);
22957 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
22958 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uintptr_t)network_update) & ~1));
22959 LDKCVec_RouteHopZ path_constr;
22960 path_constr.datalen = (*env)->GetArrayLength(env, path);
22961 if (path_constr.datalen > 0)
22962 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22964 path_constr.data = NULL;
22965 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
22966 for (size_t k = 0; k < path_constr.datalen; k++) {
22967 int64_t path_conv_10 = path_vals[k];
22968 LDKRouteHop path_conv_10_conv;
22969 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
22970 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
22971 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22972 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22973 path_constr.data[k] = path_conv_10_conv;
22975 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
22976 void* short_channel_id_ptr = (void*)(((uintptr_t)short_channel_id) & ~1);
22977 CHECK_ACCESS(short_channel_id_ptr);
22978 LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
22979 short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id) & ~1));
22980 LDKRouteParameters retry_conv;
22981 retry_conv.inner = (void*)(retry & (~1));
22982 retry_conv.is_owned = (retry & 1) || (retry == 0);
22983 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
22984 retry_conv = RouteParameters_clone(&retry_conv);
22985 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22986 *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);
22987 int64_t ret_ref = (uintptr_t)ret_copy;
22991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
22992 LDKThirtyTwoBytes payment_id_ref;
22993 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
22994 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
22995 LDKThirtyTwoBytes payment_hash_ref;
22996 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
22997 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
22998 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22999 *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
23000 int64_t ret_ref = (uintptr_t)ret_copy;
23004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
23005 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23006 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
23007 int64_t ret_ref = (uintptr_t)ret_copy;
23011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
23012 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
23013 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
23014 if (outputs_constr.datalen > 0)
23015 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
23017 outputs_constr.data = NULL;
23018 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
23019 for (size_t b = 0; b < outputs_constr.datalen; b++) {
23020 int64_t outputs_conv_27 = outputs_vals[b];
23021 void* outputs_conv_27_ptr = (void*)(((uintptr_t)outputs_conv_27) & ~1);
23022 CHECK_ACCESS(outputs_conv_27_ptr);
23023 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
23024 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)outputs_conv_27) & ~1));
23025 outputs_constr.data[b] = outputs_conv_27_conv;
23027 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
23028 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23029 *ret_copy = Event_spendable_outputs(outputs_constr);
23030 int64_t ret_ref = (uintptr_t)ret_copy;
23034 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) {
23035 void* fee_earned_msat_ptr = (void*)(((uintptr_t)fee_earned_msat) & ~1);
23036 CHECK_ACCESS(fee_earned_msat_ptr);
23037 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
23038 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)fee_earned_msat) & ~1));
23039 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23040 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
23041 int64_t ret_ref = (uintptr_t)ret_copy;
23045 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) {
23046 LDKThirtyTwoBytes channel_id_ref;
23047 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23048 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23049 void* reason_ptr = (void*)(((uintptr_t)reason) & ~1);
23050 CHECK_ACCESS(reason_ptr);
23051 LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
23052 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uintptr_t)reason) & ~1));
23053 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23054 *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
23055 int64_t ret_ref = (uintptr_t)ret_copy;
23059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) {
23060 LDKThirtyTwoBytes channel_id_ref;
23061 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
23062 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
23063 LDKTransaction transaction_ref;
23064 transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
23065 transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
23066 (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
23067 transaction_ref.data_is_owned = true;
23068 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23069 *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
23070 int64_t ret_ref = (uintptr_t)ret_copy;
23074 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) {
23075 LDKThirtyTwoBytes payment_id_ref;
23076 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
23077 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
23078 LDKThirtyTwoBytes payment_hash_ref;
23079 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
23080 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
23081 LDKCVec_RouteHopZ path_constr;
23082 path_constr.datalen = (*env)->GetArrayLength(env, path);
23083 if (path_constr.datalen > 0)
23084 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23086 path_constr.data = NULL;
23087 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
23088 for (size_t k = 0; k < path_constr.datalen; k++) {
23089 int64_t path_conv_10 = path_vals[k];
23090 LDKRouteHop path_conv_10_conv;
23091 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
23092 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
23093 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
23094 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
23095 path_constr.data[k] = path_conv_10_conv;
23097 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
23098 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23099 *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
23100 int64_t ret_ref = (uintptr_t)ret_copy;
23104 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) {
23105 LDKThirtyTwoBytes temporary_channel_id_ref;
23106 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
23107 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
23108 LDKPublicKey counterparty_node_id_ref;
23109 CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
23110 (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
23111 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
23112 *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat);
23113 int64_t ret_ref = (uintptr_t)ret_copy;
23117 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
23118 LDKEvent* obj_conv = (LDKEvent*)obj;
23119 LDKCVec_u8Z ret_var = Event_write(obj_conv);
23120 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23121 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23122 CVec_u8Z_free(ret_var);
23126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23127 LDKu8slice ser_ref;
23128 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23129 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23130 LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
23131 *ret_conv = Event_read(ser_ref);
23132 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23133 return (int64_t)ret_conv;
23136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23137 if ((this_ptr & 1) != 0) return;
23138 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23139 CHECK_ACCESS(this_ptr_ptr);
23140 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
23141 FREE((void*)this_ptr);
23142 MessageSendEvent_free(this_ptr_conv);
23145 static inline uintptr_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
23146 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23147 *ret_copy = MessageSendEvent_clone(arg);
23148 int64_t ret_ref = (uintptr_t)ret_copy;
23151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23152 LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)arg;
23153 int64_t ret_val = MessageSendEvent_clone_ptr(arg_conv);
23157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23158 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
23159 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23160 *ret_copy = MessageSendEvent_clone(orig_conv);
23161 int64_t ret_ref = (uintptr_t)ret_copy;
23165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23166 LDKPublicKey node_id_ref;
23167 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23168 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23169 LDKAcceptChannel msg_conv;
23170 msg_conv.inner = (void*)(msg & (~1));
23171 msg_conv.is_owned = (msg & 1) || (msg == 0);
23172 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23173 msg_conv = AcceptChannel_clone(&msg_conv);
23174 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23175 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
23176 int64_t ret_ref = (uintptr_t)ret_copy;
23180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23181 LDKPublicKey node_id_ref;
23182 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23183 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23184 LDKOpenChannel msg_conv;
23185 msg_conv.inner = (void*)(msg & (~1));
23186 msg_conv.is_owned = (msg & 1) || (msg == 0);
23187 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23188 msg_conv = OpenChannel_clone(&msg_conv);
23189 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23190 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
23191 int64_t ret_ref = (uintptr_t)ret_copy;
23195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23196 LDKPublicKey node_id_ref;
23197 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23198 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23199 LDKFundingCreated msg_conv;
23200 msg_conv.inner = (void*)(msg & (~1));
23201 msg_conv.is_owned = (msg & 1) || (msg == 0);
23202 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23203 msg_conv = FundingCreated_clone(&msg_conv);
23204 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23205 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
23206 int64_t ret_ref = (uintptr_t)ret_copy;
23210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23211 LDKPublicKey node_id_ref;
23212 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23213 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23214 LDKFundingSigned msg_conv;
23215 msg_conv.inner = (void*)(msg & (~1));
23216 msg_conv.is_owned = (msg & 1) || (msg == 0);
23217 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23218 msg_conv = FundingSigned_clone(&msg_conv);
23219 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23220 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
23221 int64_t ret_ref = (uintptr_t)ret_copy;
23225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23226 LDKPublicKey node_id_ref;
23227 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23228 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23229 LDKFundingLocked msg_conv;
23230 msg_conv.inner = (void*)(msg & (~1));
23231 msg_conv.is_owned = (msg & 1) || (msg == 0);
23232 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23233 msg_conv = FundingLocked_clone(&msg_conv);
23234 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23235 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
23236 int64_t ret_ref = (uintptr_t)ret_copy;
23240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23241 LDKPublicKey node_id_ref;
23242 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23243 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23244 LDKAnnouncementSignatures msg_conv;
23245 msg_conv.inner = (void*)(msg & (~1));
23246 msg_conv.is_owned = (msg & 1) || (msg == 0);
23247 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23248 msg_conv = AnnouncementSignatures_clone(&msg_conv);
23249 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23250 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
23251 int64_t ret_ref = (uintptr_t)ret_copy;
23255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
23256 LDKPublicKey node_id_ref;
23257 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23258 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23259 LDKCommitmentUpdate updates_conv;
23260 updates_conv.inner = (void*)(updates & (~1));
23261 updates_conv.is_owned = (updates & 1) || (updates == 0);
23262 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
23263 updates_conv = CommitmentUpdate_clone(&updates_conv);
23264 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23265 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
23266 int64_t ret_ref = (uintptr_t)ret_copy;
23270 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) {
23271 LDKPublicKey node_id_ref;
23272 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23273 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23274 LDKRevokeAndACK msg_conv;
23275 msg_conv.inner = (void*)(msg & (~1));
23276 msg_conv.is_owned = (msg & 1) || (msg == 0);
23277 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23278 msg_conv = RevokeAndACK_clone(&msg_conv);
23279 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23280 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
23281 int64_t ret_ref = (uintptr_t)ret_copy;
23285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23286 LDKPublicKey node_id_ref;
23287 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23288 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23289 LDKClosingSigned msg_conv;
23290 msg_conv.inner = (void*)(msg & (~1));
23291 msg_conv.is_owned = (msg & 1) || (msg == 0);
23292 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23293 msg_conv = ClosingSigned_clone(&msg_conv);
23294 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23295 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
23296 int64_t ret_ref = (uintptr_t)ret_copy;
23300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23301 LDKPublicKey node_id_ref;
23302 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23303 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23304 LDKShutdown msg_conv;
23305 msg_conv.inner = (void*)(msg & (~1));
23306 msg_conv.is_owned = (msg & 1) || (msg == 0);
23307 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23308 msg_conv = Shutdown_clone(&msg_conv);
23309 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23310 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
23311 int64_t ret_ref = (uintptr_t)ret_copy;
23315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23316 LDKPublicKey node_id_ref;
23317 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23318 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23319 LDKChannelReestablish msg_conv;
23320 msg_conv.inner = (void*)(msg & (~1));
23321 msg_conv.is_owned = (msg & 1) || (msg == 0);
23322 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23323 msg_conv = ChannelReestablish_clone(&msg_conv);
23324 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23325 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
23326 int64_t ret_ref = (uintptr_t)ret_copy;
23330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
23331 LDKChannelAnnouncement msg_conv;
23332 msg_conv.inner = (void*)(msg & (~1));
23333 msg_conv.is_owned = (msg & 1) || (msg == 0);
23334 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23335 msg_conv = ChannelAnnouncement_clone(&msg_conv);
23336 LDKChannelUpdate update_msg_conv;
23337 update_msg_conv.inner = (void*)(update_msg & (~1));
23338 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
23339 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
23340 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
23341 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23342 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
23343 int64_t ret_ref = (uintptr_t)ret_copy;
23347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
23348 LDKNodeAnnouncement msg_conv;
23349 msg_conv.inner = (void*)(msg & (~1));
23350 msg_conv.is_owned = (msg & 1) || (msg == 0);
23351 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23352 msg_conv = NodeAnnouncement_clone(&msg_conv);
23353 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23354 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
23355 int64_t ret_ref = (uintptr_t)ret_copy;
23359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
23360 LDKChannelUpdate msg_conv;
23361 msg_conv.inner = (void*)(msg & (~1));
23362 msg_conv.is_owned = (msg & 1) || (msg == 0);
23363 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23364 msg_conv = ChannelUpdate_clone(&msg_conv);
23365 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23366 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
23367 int64_t ret_ref = (uintptr_t)ret_copy;
23371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
23372 LDKPublicKey node_id_ref;
23373 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23374 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23375 LDKChannelUpdate msg_conv;
23376 msg_conv.inner = (void*)(msg & (~1));
23377 msg_conv.is_owned = (msg & 1) || (msg == 0);
23378 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23379 msg_conv = ChannelUpdate_clone(&msg_conv);
23380 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23381 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
23382 int64_t ret_ref = (uintptr_t)ret_copy;
23386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
23387 LDKPublicKey node_id_ref;
23388 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23389 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23390 void* action_ptr = (void*)(((uintptr_t)action) & ~1);
23391 CHECK_ACCESS(action_ptr);
23392 LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
23393 action_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action) & ~1));
23394 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23395 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
23396 int64_t ret_ref = (uintptr_t)ret_copy;
23400 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) {
23401 LDKPublicKey node_id_ref;
23402 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23403 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23404 LDKQueryChannelRange msg_conv;
23405 msg_conv.inner = (void*)(msg & (~1));
23406 msg_conv.is_owned = (msg & 1) || (msg == 0);
23407 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23408 msg_conv = QueryChannelRange_clone(&msg_conv);
23409 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23410 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
23411 int64_t ret_ref = (uintptr_t)ret_copy;
23415 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) {
23416 LDKPublicKey node_id_ref;
23417 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23418 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23419 LDKQueryShortChannelIds msg_conv;
23420 msg_conv.inner = (void*)(msg & (~1));
23421 msg_conv.is_owned = (msg & 1) || (msg == 0);
23422 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23423 msg_conv = QueryShortChannelIds_clone(&msg_conv);
23424 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23425 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
23426 int64_t ret_ref = (uintptr_t)ret_copy;
23430 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) {
23431 LDKPublicKey node_id_ref;
23432 CHECK((*env)->GetArrayLength(env, node_id) == 33);
23433 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
23434 LDKReplyChannelRange msg_conv;
23435 msg_conv.inner = (void*)(msg & (~1));
23436 msg_conv.is_owned = (msg & 1) || (msg == 0);
23437 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
23438 msg_conv = ReplyChannelRange_clone(&msg_conv);
23439 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
23440 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
23441 int64_t ret_ref = (uintptr_t)ret_copy;
23445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23446 if ((this_ptr & 1) != 0) return;
23447 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23448 CHECK_ACCESS(this_ptr_ptr);
23449 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
23450 FREE((void*)this_ptr);
23451 MessageSendEventsProvider_free(this_ptr_conv);
23454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23455 if ((this_ptr & 1) != 0) return;
23456 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23457 CHECK_ACCESS(this_ptr_ptr);
23458 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
23459 FREE((void*)this_ptr);
23460 EventsProvider_free(this_ptr_conv);
23463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23464 if ((this_ptr & 1) != 0) return;
23465 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23466 CHECK_ACCESS(this_ptr_ptr);
23467 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
23468 FREE((void*)this_ptr);
23469 EventHandler_free(this_ptr_conv);
23472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23473 if ((this_ptr & 1) != 0) return;
23474 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23475 CHECK_ACCESS(this_ptr_ptr);
23476 LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
23477 FREE((void*)this_ptr);
23478 APIError_free(this_ptr_conv);
23481 static inline uintptr_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
23482 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23483 *ret_copy = APIError_clone(arg);
23484 int64_t ret_ref = (uintptr_t)ret_copy;
23487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23488 LDKAPIError* arg_conv = (LDKAPIError*)arg;
23489 int64_t ret_val = APIError_clone_ptr(arg_conv);
23493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23494 LDKAPIError* orig_conv = (LDKAPIError*)orig;
23495 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23496 *ret_copy = APIError_clone(orig_conv);
23497 int64_t ret_ref = (uintptr_t)ret_copy;
23501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
23502 LDKStr err_conv = java_to_owned_str(env, err);
23503 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23504 *ret_copy = APIError_apimisuse_error(err_conv);
23505 int64_t ret_ref = (uintptr_t)ret_copy;
23509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
23510 LDKStr err_conv = java_to_owned_str(env, err);
23511 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23512 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
23513 int64_t ret_ref = (uintptr_t)ret_copy;
23517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
23518 LDKStr err_conv = java_to_owned_str(env, err);
23519 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23520 *ret_copy = APIError_route_error(err_conv);
23521 int64_t ret_ref = (uintptr_t)ret_copy;
23525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
23526 LDKStr err_conv = java_to_owned_str(env, err);
23527 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23528 *ret_copy = APIError_channel_unavailable(err_conv);
23529 int64_t ret_ref = (uintptr_t)ret_copy;
23533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
23534 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23535 *ret_copy = APIError_monitor_update_failed();
23536 int64_t ret_ref = (uintptr_t)ret_copy;
23540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
23541 LDKShutdownScript script_conv;
23542 script_conv.inner = (void*)(script & (~1));
23543 script_conv.is_owned = (script & 1) || (script == 0);
23544 CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
23545 script_conv = ShutdownScript_clone(&script_conv);
23546 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
23547 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
23548 int64_t ret_ref = (uintptr_t)ret_copy;
23552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
23553 LDKu8slice msg_ref;
23554 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23555 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23556 unsigned char sk_arr[32];
23557 CHECK((*env)->GetArrayLength(env, sk) == 32);
23558 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
23559 unsigned char (*sk_ref)[32] = &sk_arr;
23560 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
23561 *ret_conv = sign(msg_ref, sk_ref);
23562 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23563 return (int64_t)ret_conv;
23566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
23567 LDKu8slice msg_ref;
23568 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23569 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23570 LDKStr sig_conv = java_to_owned_str(env, sig);
23571 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
23572 *ret_conv = recover_pk(msg_ref, sig_conv);
23573 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23574 return (int64_t)ret_conv;
23577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
23578 LDKu8slice msg_ref;
23579 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
23580 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
23581 LDKStr sig_conv = java_to_owned_str(env, sig);
23582 LDKPublicKey pk_ref;
23583 CHECK((*env)->GetArrayLength(env, pk) == 33);
23584 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
23585 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
23586 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
23590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
23591 LDKu8slice hrp_bytes_ref;
23592 hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
23593 hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
23594 LDKCVec_u5Z data_without_signature_constr;
23595 data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
23596 if (data_without_signature_constr.datalen > 0)
23597 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
23599 data_without_signature_constr.data = NULL;
23600 int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
23601 for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
23602 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
23604 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
23606 (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
23607 LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
23608 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23609 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23610 CVec_u8Z_free(ret_var);
23611 (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
23615 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23616 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
23617 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
23621 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
23622 jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
23626 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
23627 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
23631 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
23632 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
23636 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
23637 jclass ret_conv = LDKLevel_to_java(env, Level_info());
23641 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
23642 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
23646 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
23647 jclass ret_conv = LDKLevel_to_java(env, Level_error());
23651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23652 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
23653 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
23654 jboolean ret_val = Level_eq(a_conv, b_conv);
23658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
23659 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
23660 int64_t ret_val = Level_hash(o_conv);
23664 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
23665 jclass ret_conv = LDKLevel_to_java(env, Level_max());
23669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23670 LDKRecord this_obj_conv;
23671 this_obj_conv.inner = (void*)(this_obj & (~1));
23672 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23673 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23674 Record_free(this_obj_conv);
23677 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
23678 LDKRecord this_ptr_conv;
23679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23680 this_ptr_conv.is_owned = false;
23681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23682 jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
23686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
23687 LDKRecord this_ptr_conv;
23688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23689 this_ptr_conv.is_owned = false;
23690 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23691 LDKLevel val_conv = LDKLevel_from_java(env, val);
23692 Record_set_level(&this_ptr_conv, val_conv);
23695 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
23696 LDKRecord this_ptr_conv;
23697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23698 this_ptr_conv.is_owned = false;
23699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23700 LDKStr ret_str = Record_get_args(&this_ptr_conv);
23701 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
23707 LDKRecord this_ptr_conv;
23708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23709 this_ptr_conv.is_owned = false;
23710 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23711 LDKStr val_conv = java_to_owned_str(env, val);
23712 Record_set_args(&this_ptr_conv, val_conv);
23715 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
23716 LDKRecord this_ptr_conv;
23717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23718 this_ptr_conv.is_owned = false;
23719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23720 LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
23721 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
23727 LDKRecord this_ptr_conv;
23728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23729 this_ptr_conv.is_owned = false;
23730 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23731 LDKStr val_conv = java_to_owned_str(env, val);
23732 Record_set_module_path(&this_ptr_conv, val_conv);
23735 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
23736 LDKRecord this_ptr_conv;
23737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23738 this_ptr_conv.is_owned = false;
23739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23740 LDKStr ret_str = Record_get_file(&this_ptr_conv);
23741 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
23747 LDKRecord this_ptr_conv;
23748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23749 this_ptr_conv.is_owned = false;
23750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23751 LDKStr val_conv = java_to_owned_str(env, val);
23752 Record_set_file(&this_ptr_conv, val_conv);
23755 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
23756 LDKRecord this_ptr_conv;
23757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23758 this_ptr_conv.is_owned = false;
23759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23760 int32_t ret_val = Record_get_line(&this_ptr_conv);
23764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23765 LDKRecord this_ptr_conv;
23766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23767 this_ptr_conv.is_owned = false;
23768 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23769 Record_set_line(&this_ptr_conv, val);
23772 static inline uintptr_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
23773 LDKRecord ret_var = Record_clone(arg);
23774 int64_t ret_ref = 0;
23775 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23776 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23777 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23778 ret_ref = (uintptr_t)ret_var.inner;
23779 if (ret_var.is_owned) {
23784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23785 LDKRecord arg_conv;
23786 arg_conv.inner = (void*)(arg & (~1));
23787 arg_conv.is_owned = false;
23788 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23789 int64_t ret_val = Record_clone_ptr(&arg_conv);
23793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23794 LDKRecord orig_conv;
23795 orig_conv.inner = (void*)(orig & (~1));
23796 orig_conv.is_owned = false;
23797 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23798 LDKRecord ret_var = Record_clone(&orig_conv);
23799 int64_t ret_ref = 0;
23800 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23801 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23802 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23803 ret_ref = (uintptr_t)ret_var.inner;
23804 if (ret_var.is_owned) {
23810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23811 if ((this_ptr & 1) != 0) return;
23812 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
23813 CHECK_ACCESS(this_ptr_ptr);
23814 LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
23815 FREE((void*)this_ptr);
23816 Logger_free(this_ptr_conv);
23819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23820 LDKChannelHandshakeConfig this_obj_conv;
23821 this_obj_conv.inner = (void*)(this_obj & (~1));
23822 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23824 ChannelHandshakeConfig_free(this_obj_conv);
23827 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
23828 LDKChannelHandshakeConfig this_ptr_conv;
23829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23830 this_ptr_conv.is_owned = false;
23831 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23832 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
23836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23837 LDKChannelHandshakeConfig this_ptr_conv;
23838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23839 this_ptr_conv.is_owned = false;
23840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23841 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
23844 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
23845 LDKChannelHandshakeConfig this_ptr_conv;
23846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23847 this_ptr_conv.is_owned = false;
23848 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23849 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
23853 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) {
23854 LDKChannelHandshakeConfig this_ptr_conv;
23855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23856 this_ptr_conv.is_owned = false;
23857 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23858 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
23861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23862 LDKChannelHandshakeConfig this_ptr_conv;
23863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23864 this_ptr_conv.is_owned = false;
23865 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23866 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
23870 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) {
23871 LDKChannelHandshakeConfig this_ptr_conv;
23872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23873 this_ptr_conv.is_owned = false;
23874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23875 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
23878 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) {
23879 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
23880 int64_t ret_ref = 0;
23881 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23882 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23884 ret_ref = (uintptr_t)ret_var.inner;
23885 if (ret_var.is_owned) {
23891 static inline uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
23892 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
23893 int64_t ret_ref = 0;
23894 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23895 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23896 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23897 ret_ref = (uintptr_t)ret_var.inner;
23898 if (ret_var.is_owned) {
23903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23904 LDKChannelHandshakeConfig arg_conv;
23905 arg_conv.inner = (void*)(arg & (~1));
23906 arg_conv.is_owned = false;
23907 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23908 int64_t ret_val = ChannelHandshakeConfig_clone_ptr(&arg_conv);
23912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23913 LDKChannelHandshakeConfig orig_conv;
23914 orig_conv.inner = (void*)(orig & (~1));
23915 orig_conv.is_owned = false;
23916 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23917 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
23918 int64_t ret_ref = 0;
23919 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23920 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23921 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23922 ret_ref = (uintptr_t)ret_var.inner;
23923 if (ret_var.is_owned) {
23929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
23930 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
23931 int64_t ret_ref = 0;
23932 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23933 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23935 ret_ref = (uintptr_t)ret_var.inner;
23936 if (ret_var.is_owned) {
23942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23943 LDKChannelHandshakeLimits this_obj_conv;
23944 this_obj_conv.inner = (void*)(this_obj & (~1));
23945 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23946 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23947 ChannelHandshakeLimits_free(this_obj_conv);
23950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
23951 LDKChannelHandshakeLimits this_ptr_conv;
23952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23953 this_ptr_conv.is_owned = false;
23954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23955 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
23959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23960 LDKChannelHandshakeLimits this_ptr_conv;
23961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23962 this_ptr_conv.is_owned = false;
23963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23964 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
23967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23968 LDKChannelHandshakeLimits this_ptr_conv;
23969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23970 this_ptr_conv.is_owned = false;
23971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23972 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
23976 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) {
23977 LDKChannelHandshakeLimits this_ptr_conv;
23978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23979 this_ptr_conv.is_owned = false;
23980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23981 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
23984 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) {
23985 LDKChannelHandshakeLimits this_ptr_conv;
23986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23987 this_ptr_conv.is_owned = false;
23988 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23989 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
23993 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) {
23994 LDKChannelHandshakeLimits this_ptr_conv;
23995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23996 this_ptr_conv.is_owned = false;
23997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23998 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
24001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
24002 LDKChannelHandshakeLimits this_ptr_conv;
24003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24004 this_ptr_conv.is_owned = false;
24005 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24006 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
24010 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) {
24011 LDKChannelHandshakeLimits this_ptr_conv;
24012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24013 this_ptr_conv.is_owned = false;
24014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24015 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
24018 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
24019 LDKChannelHandshakeLimits this_ptr_conv;
24020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24021 this_ptr_conv.is_owned = false;
24022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24023 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
24027 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) {
24028 LDKChannelHandshakeLimits this_ptr_conv;
24029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24030 this_ptr_conv.is_owned = false;
24031 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24032 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
24035 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
24036 LDKChannelHandshakeLimits this_ptr_conv;
24037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24038 this_ptr_conv.is_owned = false;
24039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24040 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
24044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24045 LDKChannelHandshakeLimits this_ptr_conv;
24046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24047 this_ptr_conv.is_owned = false;
24048 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24049 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
24052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
24053 LDKChannelHandshakeLimits this_ptr_conv;
24054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24055 this_ptr_conv.is_owned = false;
24056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24057 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
24061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24062 LDKChannelHandshakeLimits this_ptr_conv;
24063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24064 this_ptr_conv.is_owned = false;
24065 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24066 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
24069 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24070 LDKChannelHandshakeLimits this_ptr_conv;
24071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24072 this_ptr_conv.is_owned = false;
24073 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24074 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
24078 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) {
24079 LDKChannelHandshakeLimits this_ptr_conv;
24080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24081 this_ptr_conv.is_owned = false;
24082 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24083 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
24086 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) {
24087 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);
24088 int64_t ret_ref = 0;
24089 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24090 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24092 ret_ref = (uintptr_t)ret_var.inner;
24093 if (ret_var.is_owned) {
24099 static inline uintptr_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
24100 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
24101 int64_t ret_ref = 0;
24102 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24103 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24105 ret_ref = (uintptr_t)ret_var.inner;
24106 if (ret_var.is_owned) {
24111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24112 LDKChannelHandshakeLimits arg_conv;
24113 arg_conv.inner = (void*)(arg & (~1));
24114 arg_conv.is_owned = false;
24115 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24116 int64_t ret_val = ChannelHandshakeLimits_clone_ptr(&arg_conv);
24120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24121 LDKChannelHandshakeLimits orig_conv;
24122 orig_conv.inner = (void*)(orig & (~1));
24123 orig_conv.is_owned = false;
24124 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24125 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
24126 int64_t ret_ref = 0;
24127 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24128 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24130 ret_ref = (uintptr_t)ret_var.inner;
24131 if (ret_var.is_owned) {
24137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
24138 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
24139 int64_t ret_ref = 0;
24140 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24141 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24142 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24143 ret_ref = (uintptr_t)ret_var.inner;
24144 if (ret_var.is_owned) {
24150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24151 LDKChannelConfig this_obj_conv;
24152 this_obj_conv.inner = (void*)(this_obj & (~1));
24153 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24155 ChannelConfig_free(this_obj_conv);
24158 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
24159 LDKChannelConfig this_ptr_conv;
24160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24161 this_ptr_conv.is_owned = false;
24162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24163 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
24167 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) {
24168 LDKChannelConfig this_ptr_conv;
24169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24170 this_ptr_conv.is_owned = false;
24171 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24172 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
24175 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24176 LDKChannelConfig this_ptr_conv;
24177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24178 this_ptr_conv.is_owned = false;
24179 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24180 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
24184 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) {
24185 LDKChannelConfig this_ptr_conv;
24186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24187 this_ptr_conv.is_owned = false;
24188 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24189 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
24192 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24193 LDKChannelConfig this_ptr_conv;
24194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24195 this_ptr_conv.is_owned = false;
24196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24197 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
24201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
24202 LDKChannelConfig this_ptr_conv;
24203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24204 this_ptr_conv.is_owned = false;
24205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24206 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
24209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
24210 LDKChannelConfig this_ptr_conv;
24211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24212 this_ptr_conv.is_owned = false;
24213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24214 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
24218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24219 LDKChannelConfig this_ptr_conv;
24220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24221 this_ptr_conv.is_owned = false;
24222 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24223 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
24226 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24227 LDKChannelConfig this_ptr_conv;
24228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24229 this_ptr_conv.is_owned = false;
24230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24231 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
24235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24236 LDKChannelConfig this_ptr_conv;
24237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24238 this_ptr_conv.is_owned = false;
24239 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24240 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
24243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24244 LDKChannelConfig this_ptr_conv;
24245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24246 this_ptr_conv.is_owned = false;
24247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24248 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
24252 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) {
24253 LDKChannelConfig this_ptr_conv;
24254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24255 this_ptr_conv.is_owned = false;
24256 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24257 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
24260 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) {
24261 LDKChannelConfig this_ptr_conv;
24262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24263 this_ptr_conv.is_owned = false;
24264 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24265 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
24269 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) {
24270 LDKChannelConfig this_ptr_conv;
24271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24272 this_ptr_conv.is_owned = false;
24273 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24274 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
24277 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) {
24278 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);
24279 int64_t ret_ref = 0;
24280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24283 ret_ref = (uintptr_t)ret_var.inner;
24284 if (ret_var.is_owned) {
24290 static inline uintptr_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
24291 LDKChannelConfig ret_var = ChannelConfig_clone(arg);
24292 int64_t ret_ref = 0;
24293 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24294 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24295 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24296 ret_ref = (uintptr_t)ret_var.inner;
24297 if (ret_var.is_owned) {
24302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24303 LDKChannelConfig arg_conv;
24304 arg_conv.inner = (void*)(arg & (~1));
24305 arg_conv.is_owned = false;
24306 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24307 int64_t ret_val = ChannelConfig_clone_ptr(&arg_conv);
24311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24312 LDKChannelConfig orig_conv;
24313 orig_conv.inner = (void*)(orig & (~1));
24314 orig_conv.is_owned = false;
24315 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24316 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
24317 int64_t ret_ref = 0;
24318 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24319 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24320 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24321 ret_ref = (uintptr_t)ret_var.inner;
24322 if (ret_var.is_owned) {
24328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
24329 LDKChannelConfig ret_var = ChannelConfig_default();
24330 int64_t ret_ref = 0;
24331 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24332 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24333 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24334 ret_ref = (uintptr_t)ret_var.inner;
24335 if (ret_var.is_owned) {
24341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
24342 LDKChannelConfig obj_conv;
24343 obj_conv.inner = (void*)(obj & (~1));
24344 obj_conv.is_owned = false;
24345 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24346 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
24347 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24348 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24349 CVec_u8Z_free(ret_var);
24353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24354 LDKu8slice ser_ref;
24355 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24356 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24357 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
24358 *ret_conv = ChannelConfig_read(ser_ref);
24359 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24360 return (int64_t)ret_conv;
24363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24364 LDKUserConfig this_obj_conv;
24365 this_obj_conv.inner = (void*)(this_obj & (~1));
24366 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24368 UserConfig_free(this_obj_conv);
24371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
24372 LDKUserConfig this_ptr_conv;
24373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24374 this_ptr_conv.is_owned = false;
24375 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24376 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
24377 int64_t ret_ref = 0;
24378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24381 ret_ref = (uintptr_t)ret_var.inner;
24382 if (ret_var.is_owned) {
24388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24389 LDKUserConfig this_ptr_conv;
24390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24391 this_ptr_conv.is_owned = false;
24392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24393 LDKChannelHandshakeConfig val_conv;
24394 val_conv.inner = (void*)(val & (~1));
24395 val_conv.is_owned = (val & 1) || (val == 0);
24396 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24397 val_conv = ChannelHandshakeConfig_clone(&val_conv);
24398 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
24401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
24402 LDKUserConfig this_ptr_conv;
24403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24404 this_ptr_conv.is_owned = false;
24405 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24406 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
24407 int64_t ret_ref = 0;
24408 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24409 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24410 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24411 ret_ref = (uintptr_t)ret_var.inner;
24412 if (ret_var.is_owned) {
24418 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) {
24419 LDKUserConfig this_ptr_conv;
24420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24421 this_ptr_conv.is_owned = false;
24422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24423 LDKChannelHandshakeLimits val_conv;
24424 val_conv.inner = (void*)(val & (~1));
24425 val_conv.is_owned = (val & 1) || (val == 0);
24426 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24427 val_conv = ChannelHandshakeLimits_clone(&val_conv);
24428 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
24431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
24432 LDKUserConfig this_ptr_conv;
24433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24434 this_ptr_conv.is_owned = false;
24435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24436 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
24437 int64_t ret_ref = 0;
24438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24441 ret_ref = (uintptr_t)ret_var.inner;
24442 if (ret_var.is_owned) {
24448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24449 LDKUserConfig this_ptr_conv;
24450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24451 this_ptr_conv.is_owned = false;
24452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24453 LDKChannelConfig val_conv;
24454 val_conv.inner = (void*)(val & (~1));
24455 val_conv.is_owned = (val & 1) || (val == 0);
24456 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24457 val_conv = ChannelConfig_clone(&val_conv);
24458 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
24461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24462 LDKUserConfig this_ptr_conv;
24463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24464 this_ptr_conv.is_owned = false;
24465 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24466 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
24470 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) {
24471 LDKUserConfig 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 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
24478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24479 LDKUserConfig this_ptr_conv;
24480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24481 this_ptr_conv.is_owned = false;
24482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24483 jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
24487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24488 LDKUserConfig 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 UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
24495 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
24496 LDKUserConfig this_ptr_conv;
24497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24498 this_ptr_conv.is_owned = false;
24499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24500 jboolean ret_val = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
24504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24505 LDKUserConfig 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 UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
24512 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) {
24513 LDKChannelHandshakeConfig own_channel_config_arg_conv;
24514 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
24515 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
24516 CHECK_INNER_FIELD_ACCESS_OR_NULL(own_channel_config_arg_conv);
24517 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
24518 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
24519 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
24520 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
24521 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_channel_config_limits_arg_conv);
24522 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
24523 LDKChannelConfig channel_options_arg_conv;
24524 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
24525 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
24526 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv);
24527 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
24528 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);
24529 int64_t ret_ref = 0;
24530 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24531 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24532 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24533 ret_ref = (uintptr_t)ret_var.inner;
24534 if (ret_var.is_owned) {
24540 static inline uintptr_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24541 LDKUserConfig ret_var = UserConfig_clone(arg);
24542 int64_t ret_ref = 0;
24543 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24544 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24545 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24546 ret_ref = (uintptr_t)ret_var.inner;
24547 if (ret_var.is_owned) {
24552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24553 LDKUserConfig arg_conv;
24554 arg_conv.inner = (void*)(arg & (~1));
24555 arg_conv.is_owned = false;
24556 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24557 int64_t ret_val = UserConfig_clone_ptr(&arg_conv);
24561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24562 LDKUserConfig orig_conv;
24563 orig_conv.inner = (void*)(orig & (~1));
24564 orig_conv.is_owned = false;
24565 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24566 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24567 int64_t ret_ref = 0;
24568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24571 ret_ref = (uintptr_t)ret_var.inner;
24572 if (ret_var.is_owned) {
24578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
24579 LDKUserConfig ret_var = UserConfig_default();
24580 int64_t ret_ref = 0;
24581 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24582 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24584 ret_ref = (uintptr_t)ret_var.inner;
24585 if (ret_var.is_owned) {
24591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24592 LDKBestBlock this_obj_conv;
24593 this_obj_conv.inner = (void*)(this_obj & (~1));
24594 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24595 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24596 BestBlock_free(this_obj_conv);
24599 static inline uintptr_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24600 LDKBestBlock ret_var = BestBlock_clone(arg);
24601 int64_t ret_ref = 0;
24602 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24603 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24604 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24605 ret_ref = (uintptr_t)ret_var.inner;
24606 if (ret_var.is_owned) {
24611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24612 LDKBestBlock arg_conv;
24613 arg_conv.inner = (void*)(arg & (~1));
24614 arg_conv.is_owned = false;
24615 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24616 int64_t ret_val = BestBlock_clone_ptr(&arg_conv);
24620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24621 LDKBestBlock orig_conv;
24622 orig_conv.inner = (void*)(orig & (~1));
24623 orig_conv.is_owned = false;
24624 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24625 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
24626 int64_t ret_ref = 0;
24627 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24628 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24629 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24630 ret_ref = (uintptr_t)ret_var.inner;
24631 if (ret_var.is_owned) {
24637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
24638 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
24639 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
24640 int64_t ret_ref = 0;
24641 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24642 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24643 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24644 ret_ref = (uintptr_t)ret_var.inner;
24645 if (ret_var.is_owned) {
24651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
24652 LDKThirtyTwoBytes block_hash_ref;
24653 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
24654 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
24655 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
24656 int64_t ret_ref = 0;
24657 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24658 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24659 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24660 ret_ref = (uintptr_t)ret_var.inner;
24661 if (ret_var.is_owned) {
24667 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
24668 LDKBestBlock this_arg_conv;
24669 this_arg_conv.inner = (void*)(this_arg & (~1));
24670 this_arg_conv.is_owned = false;
24671 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24672 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24673 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
24677 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
24678 LDKBestBlock this_arg_conv;
24679 this_arg_conv.inner = (void*)(this_arg & (~1));
24680 this_arg_conv.is_owned = false;
24681 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24682 int32_t ret_val = BestBlock_height(&this_arg_conv);
24686 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24687 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
24688 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
24692 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
24693 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
24697 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
24698 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
24702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24703 if ((this_ptr & 1) != 0) return;
24704 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24705 CHECK_ACCESS(this_ptr_ptr);
24706 LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
24707 FREE((void*)this_ptr);
24708 Access_free(this_ptr_conv);
24711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24712 if ((this_ptr & 1) != 0) return;
24713 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24714 CHECK_ACCESS(this_ptr_ptr);
24715 LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
24716 FREE((void*)this_ptr);
24717 Listen_free(this_ptr_conv);
24720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24721 if ((this_ptr & 1) != 0) return;
24722 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24723 CHECK_ACCESS(this_ptr_ptr);
24724 LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
24725 FREE((void*)this_ptr);
24726 Confirm_free(this_ptr_conv);
24729 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24730 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
24731 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
24735 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
24736 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
24740 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
24741 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
24745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24746 if ((this_ptr & 1) != 0) return;
24747 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24748 CHECK_ACCESS(this_ptr_ptr);
24749 LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
24750 FREE((void*)this_ptr);
24751 Watch_free(this_ptr_conv);
24754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24755 if ((this_ptr & 1) != 0) return;
24756 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24757 CHECK_ACCESS(this_ptr_ptr);
24758 LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
24759 FREE((void*)this_ptr);
24760 Filter_free(this_ptr_conv);
24763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24764 LDKWatchedOutput this_obj_conv;
24765 this_obj_conv.inner = (void*)(this_obj & (~1));
24766 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24768 WatchedOutput_free(this_obj_conv);
24771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
24772 LDKWatchedOutput this_ptr_conv;
24773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24774 this_ptr_conv.is_owned = false;
24775 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24776 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24777 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
24781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24782 LDKWatchedOutput this_ptr_conv;
24783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24784 this_ptr_conv.is_owned = false;
24785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24786 LDKThirtyTwoBytes val_ref;
24787 CHECK((*env)->GetArrayLength(env, val) == 32);
24788 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24789 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
24792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24793 LDKWatchedOutput this_ptr_conv;
24794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24795 this_ptr_conv.is_owned = false;
24796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24797 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
24798 int64_t ret_ref = 0;
24799 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24800 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24801 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24802 ret_ref = (uintptr_t)ret_var.inner;
24803 if (ret_var.is_owned) {
24809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24810 LDKWatchedOutput this_ptr_conv;
24811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24812 this_ptr_conv.is_owned = false;
24813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24814 LDKOutPoint val_conv;
24815 val_conv.inner = (void*)(val & (~1));
24816 val_conv.is_owned = (val & 1) || (val == 0);
24817 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24818 val_conv = OutPoint_clone(&val_conv);
24819 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
24822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24823 LDKWatchedOutput this_ptr_conv;
24824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24825 this_ptr_conv.is_owned = false;
24826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24827 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
24828 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24829 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24834 LDKWatchedOutput this_ptr_conv;
24835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24836 this_ptr_conv.is_owned = false;
24837 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24838 LDKCVec_u8Z val_ref;
24839 val_ref.datalen = (*env)->GetArrayLength(env, val);
24840 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24841 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
24842 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
24845 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) {
24846 LDKThirtyTwoBytes block_hash_arg_ref;
24847 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
24848 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
24849 LDKOutPoint outpoint_arg_conv;
24850 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
24851 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
24852 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24853 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24854 LDKCVec_u8Z script_pubkey_arg_ref;
24855 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
24856 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24857 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
24858 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
24859 int64_t ret_ref = 0;
24860 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24861 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24862 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24863 ret_ref = (uintptr_t)ret_var.inner;
24864 if (ret_var.is_owned) {
24870 static inline uintptr_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
24871 LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
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) {
24882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24883 LDKWatchedOutput arg_conv;
24884 arg_conv.inner = (void*)(arg & (~1));
24885 arg_conv.is_owned = false;
24886 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24887 int64_t ret_val = WatchedOutput_clone_ptr(&arg_conv);
24891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24892 LDKWatchedOutput orig_conv;
24893 orig_conv.inner = (void*)(orig & (~1));
24894 orig_conv.is_owned = false;
24895 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24896 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
24897 int64_t ret_ref = 0;
24898 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24899 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24900 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24901 ret_ref = (uintptr_t)ret_var.inner;
24902 if (ret_var.is_owned) {
24908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
24909 LDKWatchedOutput o_conv;
24910 o_conv.inner = (void*)(o & (~1));
24911 o_conv.is_owned = false;
24912 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24913 int64_t ret_val = WatchedOutput_hash(&o_conv);
24917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24918 if ((this_ptr & 1) != 0) return;
24919 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24920 CHECK_ACCESS(this_ptr_ptr);
24921 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
24922 FREE((void*)this_ptr);
24923 BroadcasterInterface_free(this_ptr_conv);
24926 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24927 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
24928 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
24932 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
24933 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
24937 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
24938 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
24942 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
24943 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
24947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24948 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
24949 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
24950 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
24954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24955 if ((this_ptr & 1) != 0) return;
24956 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
24957 CHECK_ACCESS(this_ptr_ptr);
24958 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
24959 FREE((void*)this_ptr);
24960 FeeEstimator_free(this_ptr_conv);
24963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24964 LDKMonitorUpdateId this_obj_conv;
24965 this_obj_conv.inner = (void*)(this_obj & (~1));
24966 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24967 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24968 MonitorUpdateId_free(this_obj_conv);
24971 static inline uintptr_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
24972 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
24973 int64_t ret_ref = 0;
24974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24975 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24977 ret_ref = (uintptr_t)ret_var.inner;
24978 if (ret_var.is_owned) {
24983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24984 LDKMonitorUpdateId arg_conv;
24985 arg_conv.inner = (void*)(arg & (~1));
24986 arg_conv.is_owned = false;
24987 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24988 int64_t ret_val = MonitorUpdateId_clone_ptr(&arg_conv);
24992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24993 LDKMonitorUpdateId orig_conv;
24994 orig_conv.inner = (void*)(orig & (~1));
24995 orig_conv.is_owned = false;
24996 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24997 LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
24998 int64_t ret_ref = 0;
24999 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25000 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25001 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25002 ret_ref = (uintptr_t)ret_var.inner;
25003 if (ret_var.is_owned) {
25009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
25010 LDKMonitorUpdateId o_conv;
25011 o_conv.inner = (void*)(o & (~1));
25012 o_conv.is_owned = false;
25013 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25014 int64_t ret_val = MonitorUpdateId_hash(&o_conv);
25018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25019 LDKMonitorUpdateId a_conv;
25020 a_conv.inner = (void*)(a & (~1));
25021 a_conv.is_owned = false;
25022 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25023 LDKMonitorUpdateId b_conv;
25024 b_conv.inner = (void*)(b & (~1));
25025 b_conv.is_owned = false;
25026 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25027 jboolean ret_val = MonitorUpdateId_eq(&a_conv, &b_conv);
25031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25032 if ((this_ptr & 1) != 0) return;
25033 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25034 CHECK_ACCESS(this_ptr_ptr);
25035 LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
25036 FREE((void*)this_ptr);
25037 Persist_free(this_ptr_conv);
25040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25041 LDKLockedChannelMonitor this_obj_conv;
25042 this_obj_conv.inner = (void*)(this_obj & (~1));
25043 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25045 LockedChannelMonitor_free(this_obj_conv);
25048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25049 LDKChainMonitor this_obj_conv;
25050 this_obj_conv.inner = (void*)(this_obj & (~1));
25051 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25052 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25053 ChainMonitor_free(this_obj_conv);
25056 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) {
25057 void* chain_source_ptr = (void*)(((uintptr_t)chain_source) & ~1);
25058 CHECK_ACCESS(chain_source_ptr);
25059 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
25060 // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
25061 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
25062 // Manually implement clone for Java trait instances
25063 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
25064 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25065 LDKFilter_JCalls_cloned(&chain_source_conv.some);
25068 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25069 CHECK_ACCESS(broadcaster_ptr);
25070 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25071 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25072 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25073 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25075 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25076 CHECK_ACCESS(logger_ptr);
25077 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25078 if (logger_conv.free == LDKLogger_JCalls_free) {
25079 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25080 LDKLogger_JCalls_cloned(&logger_conv);
25082 void* feeest_ptr = (void*)(((uintptr_t)feeest) & ~1);
25083 CHECK_ACCESS(feeest_ptr);
25084 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
25085 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
25086 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25087 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
25089 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
25090 CHECK_ACCESS(persister_ptr);
25091 LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
25092 if (persister_conv.free == LDKPersist_JCalls_free) {
25093 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25094 LDKPersist_JCalls_cloned(&persister_conv);
25096 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
25097 int64_t ret_ref = 0;
25098 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25099 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25100 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25101 ret_ref = (uintptr_t)ret_var.inner;
25102 if (ret_var.is_owned) {
25108 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) {
25109 LDKChainMonitor this_arg_conv;
25110 this_arg_conv.inner = (void*)(this_arg & (~1));
25111 this_arg_conv.is_owned = false;
25112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25113 LDKCVec_ChannelDetailsZ ignored_channels_constr;
25114 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
25115 if (ignored_channels_constr.datalen > 0)
25116 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25118 ignored_channels_constr.data = NULL;
25119 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
25120 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
25121 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
25122 LDKChannelDetails ignored_channels_conv_16_conv;
25123 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
25124 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
25125 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
25126 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
25127 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
25129 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
25130 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
25131 int64_tArray ret_arr = NULL;
25132 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25133 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25134 for (size_t j = 0; j < ret_var.datalen; j++) {
25135 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25136 *ret_conv_9_copy = ret_var.data[j];
25137 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
25138 ret_arr_ptr[j] = ret_conv_9_ref;
25140 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25141 FREE(ret_var.data);
25145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
25146 LDKChainMonitor this_arg_conv;
25147 this_arg_conv.inner = (void*)(this_arg & (~1));
25148 this_arg_conv.is_owned = false;
25149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25150 LDKOutPoint funding_txo_conv;
25151 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25152 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25153 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25154 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25155 LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
25156 *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
25157 return (int64_t)ret_conv;
25160 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
25161 LDKChainMonitor this_arg_conv;
25162 this_arg_conv.inner = (void*)(this_arg & (~1));
25163 this_arg_conv.is_owned = false;
25164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25165 LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
25166 int64_tArray ret_arr = NULL;
25167 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25168 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25169 for (size_t k = 0; k < ret_var.datalen; k++) {
25170 LDKOutPoint ret_conv_10_var = ret_var.data[k];
25171 int64_t ret_conv_10_ref = 0;
25172 CHECK((((uintptr_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25173 CHECK((((uintptr_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
25175 ret_conv_10_ref = (uintptr_t)ret_conv_10_var.inner;
25176 if (ret_conv_10_var.is_owned) {
25177 ret_conv_10_ref |= 1;
25179 ret_arr_ptr[k] = ret_conv_10_ref;
25181 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25182 FREE(ret_var.data);
25186 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) {
25187 LDKChainMonitor this_arg_conv;
25188 this_arg_conv.inner = (void*)(this_arg & (~1));
25189 this_arg_conv.is_owned = false;
25190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25191 LDKOutPoint funding_txo_conv;
25192 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25193 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25194 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25195 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25196 LDKMonitorUpdateId completed_update_id_conv;
25197 completed_update_id_conv.inner = (void*)(completed_update_id & (~1));
25198 completed_update_id_conv.is_owned = (completed_update_id & 1) || (completed_update_id == 0);
25199 CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
25200 completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
25201 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
25202 *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
25203 return (int64_t)ret_conv;
25206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
25207 LDKChainMonitor this_arg_conv;
25208 this_arg_conv.inner = (void*)(this_arg & (~1));
25209 this_arg_conv.is_owned = false;
25210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25211 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
25212 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
25213 return (int64_t)ret_ret;
25216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
25217 LDKChainMonitor this_arg_conv;
25218 this_arg_conv.inner = (void*)(this_arg & (~1));
25219 this_arg_conv.is_owned = false;
25220 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25221 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
25222 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
25223 return (int64_t)ret_ret;
25226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
25227 LDKChainMonitor this_arg_conv;
25228 this_arg_conv.inner = (void*)(this_arg & (~1));
25229 this_arg_conv.is_owned = false;
25230 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25231 LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
25232 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
25233 return (int64_t)ret_ret;
25236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25237 LDKChainMonitor this_arg_conv;
25238 this_arg_conv.inner = (void*)(this_arg & (~1));
25239 this_arg_conv.is_owned = false;
25240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25241 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
25242 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
25243 return (int64_t)ret_ret;
25246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25247 LDKChannelMonitorUpdate this_obj_conv;
25248 this_obj_conv.inner = (void*)(this_obj & (~1));
25249 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25250 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25251 ChannelMonitorUpdate_free(this_obj_conv);
25254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
25255 LDKChannelMonitorUpdate this_ptr_conv;
25256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25257 this_ptr_conv.is_owned = false;
25258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25259 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
25263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25264 LDKChannelMonitorUpdate this_ptr_conv;
25265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25266 this_ptr_conv.is_owned = false;
25267 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25268 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
25271 static inline uintptr_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
25272 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
25273 int64_t ret_ref = 0;
25274 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25275 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25277 ret_ref = (uintptr_t)ret_var.inner;
25278 if (ret_var.is_owned) {
25283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25284 LDKChannelMonitorUpdate arg_conv;
25285 arg_conv.inner = (void*)(arg & (~1));
25286 arg_conv.is_owned = false;
25287 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25288 int64_t ret_val = ChannelMonitorUpdate_clone_ptr(&arg_conv);
25292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25293 LDKChannelMonitorUpdate orig_conv;
25294 orig_conv.inner = (void*)(orig & (~1));
25295 orig_conv.is_owned = false;
25296 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25297 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
25298 int64_t ret_ref = 0;
25299 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25300 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25302 ret_ref = (uintptr_t)ret_var.inner;
25303 if (ret_var.is_owned) {
25309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25310 LDKChannelMonitorUpdate obj_conv;
25311 obj_conv.inner = (void*)(obj & (~1));
25312 obj_conv.is_owned = false;
25313 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25314 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
25315 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25316 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25317 CVec_u8Z_free(ret_var);
25321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25322 LDKu8slice ser_ref;
25323 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25324 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25325 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
25326 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
25327 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25328 return (int64_t)ret_conv;
25331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25332 if ((this_ptr & 1) != 0) return;
25333 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25334 CHECK_ACCESS(this_ptr_ptr);
25335 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
25336 FREE((void*)this_ptr);
25337 MonitorEvent_free(this_ptr_conv);
25340 static inline uintptr_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
25341 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25342 *ret_copy = MonitorEvent_clone(arg);
25343 int64_t ret_ref = (uintptr_t)ret_copy;
25346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25347 LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)arg;
25348 int64_t ret_val = MonitorEvent_clone_ptr(arg_conv);
25352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25353 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
25354 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25355 *ret_copy = MonitorEvent_clone(orig_conv);
25356 int64_t ret_ref = (uintptr_t)ret_copy;
25360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
25361 LDKHTLCUpdate a_conv;
25362 a_conv.inner = (void*)(a & (~1));
25363 a_conv.is_owned = (a & 1) || (a == 0);
25364 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25365 a_conv = HTLCUpdate_clone(&a_conv);
25366 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25367 *ret_copy = MonitorEvent_htlcevent(a_conv);
25368 int64_t ret_ref = (uintptr_t)ret_copy;
25372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
25373 LDKOutPoint a_conv;
25374 a_conv.inner = (void*)(a & (~1));
25375 a_conv.is_owned = (a & 1) || (a == 0);
25376 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25377 a_conv = OutPoint_clone(&a_conv);
25378 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25379 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
25380 int64_t ret_ref = (uintptr_t)ret_copy;
25384 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) {
25385 LDKOutPoint funding_txo_conv;
25386 funding_txo_conv.inner = (void*)(funding_txo & (~1));
25387 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
25388 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
25389 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
25390 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25391 *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
25392 int64_t ret_ref = (uintptr_t)ret_copy;
25396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1update_1failed(JNIEnv *env, jclass clz, int64_t a) {
25397 LDKOutPoint a_conv;
25398 a_conv.inner = (void*)(a & (~1));
25399 a_conv.is_owned = (a & 1) || (a == 0);
25400 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25401 a_conv = OutPoint_clone(&a_conv);
25402 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25403 *ret_copy = MonitorEvent_update_failed(a_conv);
25404 int64_t ret_ref = (uintptr_t)ret_copy;
25408 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
25409 LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)obj;
25410 LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
25411 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25412 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25413 CVec_u8Z_free(ret_var);
25417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25418 LDKu8slice ser_ref;
25419 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25420 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25421 LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
25422 *ret_conv = MonitorEvent_read(ser_ref);
25423 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25424 return (int64_t)ret_conv;
25427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25428 LDKHTLCUpdate this_obj_conv;
25429 this_obj_conv.inner = (void*)(this_obj & (~1));
25430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25432 HTLCUpdate_free(this_obj_conv);
25435 static inline uintptr_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
25436 LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
25437 int64_t ret_ref = 0;
25438 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25439 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25440 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25441 ret_ref = (uintptr_t)ret_var.inner;
25442 if (ret_var.is_owned) {
25447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25448 LDKHTLCUpdate arg_conv;
25449 arg_conv.inner = (void*)(arg & (~1));
25450 arg_conv.is_owned = false;
25451 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25452 int64_t ret_val = HTLCUpdate_clone_ptr(&arg_conv);
25456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25457 LDKHTLCUpdate orig_conv;
25458 orig_conv.inner = (void*)(orig & (~1));
25459 orig_conv.is_owned = false;
25460 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25461 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
25462 int64_t ret_ref = 0;
25463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25466 ret_ref = (uintptr_t)ret_var.inner;
25467 if (ret_var.is_owned) {
25473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
25474 LDKHTLCUpdate obj_conv;
25475 obj_conv.inner = (void*)(obj & (~1));
25476 obj_conv.is_owned = false;
25477 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25478 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25479 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25480 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25481 CVec_u8Z_free(ret_var);
25485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25486 LDKu8slice ser_ref;
25487 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25488 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25489 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25490 *ret_conv = HTLCUpdate_read(ser_ref);
25491 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25492 return (int64_t)ret_conv;
25495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25496 if ((this_ptr & 1) != 0) return;
25497 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
25498 CHECK_ACCESS(this_ptr_ptr);
25499 LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25500 FREE((void*)this_ptr);
25501 Balance_free(this_ptr_conv);
25504 static inline uintptr_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25505 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25506 *ret_copy = Balance_clone(arg);
25507 int64_t ret_ref = (uintptr_t)ret_copy;
25510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25511 LDKBalance* arg_conv = (LDKBalance*)arg;
25512 int64_t ret_val = Balance_clone_ptr(arg_conv);
25516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25517 LDKBalance* orig_conv = (LDKBalance*)orig;
25518 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25519 *ret_copy = Balance_clone(orig_conv);
25520 int64_t ret_ref = (uintptr_t)ret_copy;
25524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
25525 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25526 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25527 int64_t ret_ref = (uintptr_t)ret_copy;
25531 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) {
25532 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25533 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25534 int64_t ret_ref = (uintptr_t)ret_copy;
25538 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) {
25539 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25540 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25541 int64_t ret_ref = (uintptr_t)ret_copy;
25545 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) {
25546 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25547 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
25548 int64_t ret_ref = (uintptr_t)ret_copy;
25552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25553 LDKBalance* a_conv = (LDKBalance*)a;
25554 LDKBalance* b_conv = (LDKBalance*)b;
25555 jboolean ret_val = Balance_eq(a_conv, b_conv);
25559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25560 LDKChannelMonitor this_obj_conv;
25561 this_obj_conv.inner = (void*)(this_obj & (~1));
25562 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25564 ChannelMonitor_free(this_obj_conv);
25567 static inline uintptr_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25568 LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25569 int64_t ret_ref = 0;
25570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25573 ret_ref = (uintptr_t)ret_var.inner;
25574 if (ret_var.is_owned) {
25579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25580 LDKChannelMonitor arg_conv;
25581 arg_conv.inner = (void*)(arg & (~1));
25582 arg_conv.is_owned = false;
25583 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25584 int64_t ret_val = ChannelMonitor_clone_ptr(&arg_conv);
25588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25589 LDKChannelMonitor orig_conv;
25590 orig_conv.inner = (void*)(orig & (~1));
25591 orig_conv.is_owned = false;
25592 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25593 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25594 int64_t ret_ref = 0;
25595 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25596 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25597 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25598 ret_ref = (uintptr_t)ret_var.inner;
25599 if (ret_var.is_owned) {
25605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
25606 LDKChannelMonitor obj_conv;
25607 obj_conv.inner = (void*)(obj & (~1));
25608 obj_conv.is_owned = false;
25609 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25610 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25611 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25612 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25613 CVec_u8Z_free(ret_var);
25617 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) {
25618 LDKChannelMonitor this_arg_conv;
25619 this_arg_conv.inner = (void*)(this_arg & (~1));
25620 this_arg_conv.is_owned = false;
25621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25622 LDKChannelMonitorUpdate updates_conv;
25623 updates_conv.inner = (void*)(updates & (~1));
25624 updates_conv.is_owned = false;
25625 CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25626 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25627 if (!(broadcaster & 1)) { CHECK_ACCESS(broadcaster_ptr); }
25628 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
25629 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25630 if (!(fee_estimator & 1)) { CHECK_ACCESS(fee_estimator_ptr); }
25631 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
25632 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25633 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
25634 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25635 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25636 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25637 return (int64_t)ret_conv;
25640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
25641 LDKChannelMonitor this_arg_conv;
25642 this_arg_conv.inner = (void*)(this_arg & (~1));
25643 this_arg_conv.is_owned = false;
25644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25645 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
25649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
25650 LDKChannelMonitor this_arg_conv;
25651 this_arg_conv.inner = (void*)(this_arg & (~1));
25652 this_arg_conv.is_owned = false;
25653 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25654 LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25655 *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
25656 return ((int64_t)ret_conv);
25659 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
25660 LDKChannelMonitor this_arg_conv;
25661 this_arg_conv.inner = (void*)(this_arg & (~1));
25662 this_arg_conv.is_owned = false;
25663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25664 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
25665 int64_tArray ret_arr = NULL;
25666 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25667 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25668 for (size_t o = 0; o < ret_var.datalen; o++) {
25669 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25670 *ret_conv_40_conv = ret_var.data[o];
25671 ret_arr_ptr[o] = ((int64_t)ret_conv_40_conv);
25673 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25674 FREE(ret_var.data);
25678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
25679 LDKChannelMonitor this_arg_conv;
25680 this_arg_conv.inner = (void*)(this_arg & (~1));
25681 this_arg_conv.is_owned = false;
25682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25683 void* filter_ptr = (void*)(((uintptr_t)filter) & ~1);
25684 if (!(filter & 1)) { CHECK_ACCESS(filter_ptr); }
25685 LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
25686 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
25689 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
25690 LDKChannelMonitor this_arg_conv;
25691 this_arg_conv.inner = (void*)(this_arg & (~1));
25692 this_arg_conv.is_owned = false;
25693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25694 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
25695 int64_tArray ret_arr = NULL;
25696 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25697 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25698 for (size_t o = 0; o < ret_var.datalen; o++) {
25699 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25700 *ret_conv_14_copy = ret_var.data[o];
25701 int64_t ret_conv_14_ref = (uintptr_t)ret_conv_14_copy;
25702 ret_arr_ptr[o] = ret_conv_14_ref;
25704 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25705 FREE(ret_var.data);
25709 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
25710 LDKChannelMonitor this_arg_conv;
25711 this_arg_conv.inner = (void*)(this_arg & (~1));
25712 this_arg_conv.is_owned = false;
25713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25714 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
25715 int64_tArray ret_arr = NULL;
25716 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25717 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25718 for (size_t h = 0; h < ret_var.datalen; h++) {
25719 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25720 *ret_conv_7_copy = ret_var.data[h];
25721 int64_t ret_conv_7_ref = (uintptr_t)ret_conv_7_copy;
25722 ret_arr_ptr[h] = ret_conv_7_ref;
25724 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25725 FREE(ret_var.data);
25729 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) {
25730 LDKChannelMonitor this_arg_conv;
25731 this_arg_conv.inner = (void*)(this_arg & (~1));
25732 this_arg_conv.is_owned = false;
25733 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25734 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25735 if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); }
25736 LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25737 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
25738 jobjectArray ret_arr = NULL;
25739 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
25741 for (size_t i = 0; i < ret_var.datalen; i++) {
25742 LDKTransaction ret_conv_8_var = ret_var.data[i];
25743 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
25744 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
25745 Transaction_free(ret_conv_8_var);
25746 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
25749 FREE(ret_var.data);
25753 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) {
25754 LDKChannelMonitor this_arg_conv;
25755 this_arg_conv.inner = (void*)(this_arg & (~1));
25756 this_arg_conv.is_owned = false;
25757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25758 unsigned char header_arr[80];
25759 CHECK((*env)->GetArrayLength(env, header) == 80);
25760 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
25761 unsigned char (*header_ref)[80] = &header_arr;
25762 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25763 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
25764 if (txdata_constr.datalen > 0)
25765 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25767 txdata_constr.data = NULL;
25768 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
25769 for (size_t c = 0; c < txdata_constr.datalen; c++) {
25770 int64_t txdata_conv_28 = txdata_vals[c];
25771 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
25772 CHECK_ACCESS(txdata_conv_28_ptr);
25773 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25774 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
25775 txdata_constr.data[c] = txdata_conv_28_conv;
25777 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
25778 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25779 CHECK_ACCESS(broadcaster_ptr);
25780 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25781 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25782 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25783 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25785 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25786 CHECK_ACCESS(fee_estimator_ptr);
25787 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25788 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25789 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25790 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25792 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25793 CHECK_ACCESS(logger_ptr);
25794 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25795 if (logger_conv.free == LDKLogger_JCalls_free) {
25796 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25797 LDKLogger_JCalls_cloned(&logger_conv);
25799 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);
25800 int64_tArray ret_arr = NULL;
25801 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25802 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25803 for (size_t n = 0; n < ret_var.datalen; n++) {
25804 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25805 *ret_conv_39_conv = ret_var.data[n];
25806 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
25808 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25809 FREE(ret_var.data);
25813 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) {
25814 LDKChannelMonitor this_arg_conv;
25815 this_arg_conv.inner = (void*)(this_arg & (~1));
25816 this_arg_conv.is_owned = false;
25817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25818 unsigned char header_arr[80];
25819 CHECK((*env)->GetArrayLength(env, header) == 80);
25820 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
25821 unsigned char (*header_ref)[80] = &header_arr;
25822 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25823 CHECK_ACCESS(broadcaster_ptr);
25824 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25825 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25826 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25827 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25829 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25830 CHECK_ACCESS(fee_estimator_ptr);
25831 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25832 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25833 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25834 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25836 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25837 CHECK_ACCESS(logger_ptr);
25838 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25839 if (logger_conv.free == LDKLogger_JCalls_free) {
25840 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25841 LDKLogger_JCalls_cloned(&logger_conv);
25843 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25846 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) {
25847 LDKChannelMonitor this_arg_conv;
25848 this_arg_conv.inner = (void*)(this_arg & (~1));
25849 this_arg_conv.is_owned = false;
25850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25851 unsigned char header_arr[80];
25852 CHECK((*env)->GetArrayLength(env, header) == 80);
25853 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
25854 unsigned char (*header_ref)[80] = &header_arr;
25855 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25856 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
25857 if (txdata_constr.datalen > 0)
25858 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25860 txdata_constr.data = NULL;
25861 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
25862 for (size_t c = 0; c < txdata_constr.datalen; c++) {
25863 int64_t txdata_conv_28 = txdata_vals[c];
25864 void* txdata_conv_28_ptr = (void*)(((uintptr_t)txdata_conv_28) & ~1);
25865 CHECK_ACCESS(txdata_conv_28_ptr);
25866 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25867 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uintptr_t)txdata_conv_28) & ~1));
25868 txdata_constr.data[c] = txdata_conv_28_conv;
25870 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
25871 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25872 CHECK_ACCESS(broadcaster_ptr);
25873 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25874 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25875 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25876 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25878 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25879 CHECK_ACCESS(fee_estimator_ptr);
25880 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25881 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25882 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25883 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25885 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25886 CHECK_ACCESS(logger_ptr);
25887 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25888 if (logger_conv.free == LDKLogger_JCalls_free) {
25889 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25890 LDKLogger_JCalls_cloned(&logger_conv);
25892 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);
25893 int64_tArray ret_arr = NULL;
25894 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25895 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25896 for (size_t n = 0; n < ret_var.datalen; n++) {
25897 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25898 *ret_conv_39_conv = ret_var.data[n];
25899 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
25901 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25902 FREE(ret_var.data);
25906 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) {
25907 LDKChannelMonitor this_arg_conv;
25908 this_arg_conv.inner = (void*)(this_arg & (~1));
25909 this_arg_conv.is_owned = false;
25910 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25911 unsigned char txid_arr[32];
25912 CHECK((*env)->GetArrayLength(env, txid) == 32);
25913 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
25914 unsigned char (*txid_ref)[32] = &txid_arr;
25915 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25916 CHECK_ACCESS(broadcaster_ptr);
25917 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25918 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25919 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25920 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25922 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25923 CHECK_ACCESS(fee_estimator_ptr);
25924 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25925 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25926 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25927 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25929 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25930 CHECK_ACCESS(logger_ptr);
25931 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25932 if (logger_conv.free == LDKLogger_JCalls_free) {
25933 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25934 LDKLogger_JCalls_cloned(&logger_conv);
25936 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
25939 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) {
25940 LDKChannelMonitor this_arg_conv;
25941 this_arg_conv.inner = (void*)(this_arg & (~1));
25942 this_arg_conv.is_owned = false;
25943 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25944 unsigned char header_arr[80];
25945 CHECK((*env)->GetArrayLength(env, header) == 80);
25946 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
25947 unsigned char (*header_ref)[80] = &header_arr;
25948 void* broadcaster_ptr = (void*)(((uintptr_t)broadcaster) & ~1);
25949 CHECK_ACCESS(broadcaster_ptr);
25950 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25951 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25952 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25953 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25955 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
25956 CHECK_ACCESS(fee_estimator_ptr);
25957 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25958 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25959 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25960 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25962 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
25963 CHECK_ACCESS(logger_ptr);
25964 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25965 if (logger_conv.free == LDKLogger_JCalls_free) {
25966 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25967 LDKLogger_JCalls_cloned(&logger_conv);
25969 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25970 int64_tArray ret_arr = NULL;
25971 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25972 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25973 for (size_t n = 0; n < ret_var.datalen; n++) {
25974 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25975 *ret_conv_39_conv = ret_var.data[n];
25976 ret_arr_ptr[n] = ((int64_t)ret_conv_39_conv);
25978 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25979 FREE(ret_var.data);
25983 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
25984 LDKChannelMonitor this_arg_conv;
25985 this_arg_conv.inner = (void*)(this_arg & (~1));
25986 this_arg_conv.is_owned = false;
25987 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25988 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
25989 jobjectArray ret_arr = NULL;
25990 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
25992 for (size_t i = 0; i < ret_var.datalen; i++) {
25993 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
25994 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
25995 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
25998 FREE(ret_var.data);
26002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
26003 LDKChannelMonitor this_arg_conv;
26004 this_arg_conv.inner = (void*)(this_arg & (~1));
26005 this_arg_conv.is_owned = false;
26006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26007 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
26008 int64_t ret_ref = 0;
26009 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26010 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26011 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26012 ret_ref = (uintptr_t)ret_var.inner;
26013 if (ret_var.is_owned) {
26019 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
26020 LDKChannelMonitor this_arg_conv;
26021 this_arg_conv.inner = (void*)(this_arg & (~1));
26022 this_arg_conv.is_owned = false;
26023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26024 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
26025 int64_tArray ret_arr = NULL;
26026 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26027 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26028 for (size_t j = 0; j < ret_var.datalen; j++) {
26029 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
26030 *ret_conv_9_copy = ret_var.data[j];
26031 int64_t ret_conv_9_ref = (uintptr_t)ret_conv_9_copy;
26032 ret_arr_ptr[j] = ret_conv_9_ref;
26034 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26035 FREE(ret_var.data);
26039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
26040 LDKu8slice ser_ref;
26041 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26042 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26043 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
26044 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
26045 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
26046 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
26047 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
26048 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26049 return (int64_t)ret_conv;
26052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26053 LDKOutPoint this_obj_conv;
26054 this_obj_conv.inner = (void*)(this_obj & (~1));
26055 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26056 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26057 OutPoint_free(this_obj_conv);
26060 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
26061 LDKOutPoint this_ptr_conv;
26062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26063 this_ptr_conv.is_owned = false;
26064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26065 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26066 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
26070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26071 LDKOutPoint this_ptr_conv;
26072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26073 this_ptr_conv.is_owned = false;
26074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26075 LDKThirtyTwoBytes val_ref;
26076 CHECK((*env)->GetArrayLength(env, val) == 32);
26077 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26078 OutPoint_set_txid(&this_ptr_conv, val_ref);
26081 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
26082 LDKOutPoint this_ptr_conv;
26083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26084 this_ptr_conv.is_owned = false;
26085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26086 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
26090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26091 LDKOutPoint this_ptr_conv;
26092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26093 this_ptr_conv.is_owned = false;
26094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26095 OutPoint_set_index(&this_ptr_conv, val);
26098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
26099 LDKThirtyTwoBytes txid_arg_ref;
26100 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
26101 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
26102 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
26103 int64_t ret_ref = 0;
26104 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26105 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26106 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26107 ret_ref = (uintptr_t)ret_var.inner;
26108 if (ret_var.is_owned) {
26114 static inline uintptr_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
26115 LDKOutPoint ret_var = OutPoint_clone(arg);
26116 int64_t ret_ref = 0;
26117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26120 ret_ref = (uintptr_t)ret_var.inner;
26121 if (ret_var.is_owned) {
26126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26127 LDKOutPoint arg_conv;
26128 arg_conv.inner = (void*)(arg & (~1));
26129 arg_conv.is_owned = false;
26130 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26131 int64_t ret_val = OutPoint_clone_ptr(&arg_conv);
26135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26136 LDKOutPoint orig_conv;
26137 orig_conv.inner = (void*)(orig & (~1));
26138 orig_conv.is_owned = false;
26139 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26140 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
26141 int64_t ret_ref = 0;
26142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26145 ret_ref = (uintptr_t)ret_var.inner;
26146 if (ret_var.is_owned) {
26152 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26153 LDKOutPoint a_conv;
26154 a_conv.inner = (void*)(a & (~1));
26155 a_conv.is_owned = false;
26156 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26157 LDKOutPoint b_conv;
26158 b_conv.inner = (void*)(b & (~1));
26159 b_conv.is_owned = false;
26160 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26161 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
26165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
26166 LDKOutPoint o_conv;
26167 o_conv.inner = (void*)(o & (~1));
26168 o_conv.is_owned = false;
26169 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26170 int64_t ret_val = OutPoint_hash(&o_conv);
26174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
26175 LDKOutPoint this_arg_conv;
26176 this_arg_conv.inner = (void*)(this_arg & (~1));
26177 this_arg_conv.is_owned = false;
26178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26179 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26180 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
26184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
26185 LDKOutPoint obj_conv;
26186 obj_conv.inner = (void*)(obj & (~1));
26187 obj_conv.is_owned = false;
26188 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26189 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
26190 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26191 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26192 CVec_u8Z_free(ret_var);
26196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26197 LDKu8slice ser_ref;
26198 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26199 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26200 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
26201 *ret_conv = OutPoint_read(ser_ref);
26202 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26203 return (int64_t)ret_conv;
26206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26207 LDKDelayedPaymentOutputDescriptor this_obj_conv;
26208 this_obj_conv.inner = (void*)(this_obj & (~1));
26209 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26211 DelayedPaymentOutputDescriptor_free(this_obj_conv);
26214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26215 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26217 this_ptr_conv.is_owned = false;
26218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26219 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26220 int64_t ret_ref = 0;
26221 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26222 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26223 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26224 ret_ref = (uintptr_t)ret_var.inner;
26225 if (ret_var.is_owned) {
26231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26232 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26234 this_ptr_conv.is_owned = false;
26235 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26236 LDKOutPoint val_conv;
26237 val_conv.inner = (void*)(val & (~1));
26238 val_conv.is_owned = (val & 1) || (val == 0);
26239 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26240 val_conv = OutPoint_clone(&val_conv);
26241 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26244 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
26245 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26247 this_ptr_conv.is_owned = false;
26248 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26249 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26250 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
26254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26255 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26257 this_ptr_conv.is_owned = false;
26258 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26259 LDKPublicKey val_ref;
26260 CHECK((*env)->GetArrayLength(env, val) == 33);
26261 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26262 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
26265 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
26266 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26268 this_ptr_conv.is_owned = false;
26269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26270 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
26274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26275 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26277 this_ptr_conv.is_owned = false;
26278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26279 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
26282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26283 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26285 this_ptr_conv.is_owned = false;
26286 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26287 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26288 CHECK_ACCESS(val_ptr);
26289 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26290 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
26291 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26294 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26295 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26297 this_ptr_conv.is_owned = false;
26298 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26299 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26300 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
26304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26305 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26307 this_ptr_conv.is_owned = false;
26308 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26309 LDKPublicKey val_ref;
26310 CHECK((*env)->GetArrayLength(env, val) == 33);
26311 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26312 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
26315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26316 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26318 this_ptr_conv.is_owned = false;
26319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26320 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26321 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
26325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26326 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26328 this_ptr_conv.is_owned = false;
26329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26330 LDKThirtyTwoBytes val_ref;
26331 CHECK((*env)->GetArrayLength(env, val) == 32);
26332 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26333 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26337 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26339 this_ptr_conv.is_owned = false;
26340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26341 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26346 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
26347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26348 this_ptr_conv.is_owned = false;
26349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26350 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26353 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) {
26354 LDKOutPoint outpoint_arg_conv;
26355 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26356 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26357 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26358 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26359 LDKPublicKey per_commitment_point_arg_ref;
26360 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
26361 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
26362 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
26363 CHECK_ACCESS(output_arg_ptr);
26364 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26365 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
26366 LDKPublicKey revocation_pubkey_arg_ref;
26367 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
26368 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
26369 LDKThirtyTwoBytes channel_keys_id_arg_ref;
26370 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
26371 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
26372 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);
26373 int64_t ret_ref = 0;
26374 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26375 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26376 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26377 ret_ref = (uintptr_t)ret_var.inner;
26378 if (ret_var.is_owned) {
26384 static inline uintptr_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
26385 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
26386 int64_t ret_ref = 0;
26387 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26388 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26389 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26390 ret_ref = (uintptr_t)ret_var.inner;
26391 if (ret_var.is_owned) {
26396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26397 LDKDelayedPaymentOutputDescriptor arg_conv;
26398 arg_conv.inner = (void*)(arg & (~1));
26399 arg_conv.is_owned = false;
26400 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26401 int64_t ret_val = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
26405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26406 LDKDelayedPaymentOutputDescriptor orig_conv;
26407 orig_conv.inner = (void*)(orig & (~1));
26408 orig_conv.is_owned = false;
26409 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26410 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
26411 int64_t ret_ref = 0;
26412 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26413 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26414 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26415 ret_ref = (uintptr_t)ret_var.inner;
26416 if (ret_var.is_owned) {
26422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26423 LDKDelayedPaymentOutputDescriptor obj_conv;
26424 obj_conv.inner = (void*)(obj & (~1));
26425 obj_conv.is_owned = false;
26426 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26427 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26428 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26429 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26430 CVec_u8Z_free(ret_var);
26434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26435 LDKu8slice ser_ref;
26436 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26437 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26438 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26439 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26440 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26441 return (int64_t)ret_conv;
26444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26445 LDKStaticPaymentOutputDescriptor this_obj_conv;
26446 this_obj_conv.inner = (void*)(this_obj & (~1));
26447 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26449 StaticPaymentOutputDescriptor_free(this_obj_conv);
26452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
26453 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26455 this_ptr_conv.is_owned = false;
26456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26457 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26458 int64_t ret_ref = 0;
26459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26462 ret_ref = (uintptr_t)ret_var.inner;
26463 if (ret_var.is_owned) {
26469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26470 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26472 this_ptr_conv.is_owned = false;
26473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26474 LDKOutPoint val_conv;
26475 val_conv.inner = (void*)(val & (~1));
26476 val_conv.is_owned = (val & 1) || (val == 0);
26477 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26478 val_conv = OutPoint_clone(&val_conv);
26479 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26483 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26485 this_ptr_conv.is_owned = false;
26486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26487 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
26488 CHECK_ACCESS(val_ptr);
26489 LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26490 val_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)val) & ~1));
26491 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26495 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26497 this_ptr_conv.is_owned = false;
26498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26499 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26500 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
26504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26505 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26507 this_ptr_conv.is_owned = false;
26508 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26509 LDKThirtyTwoBytes val_ref;
26510 CHECK((*env)->GetArrayLength(env, val) == 32);
26511 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26512 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
26516 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26518 this_ptr_conv.is_owned = false;
26519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26520 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26525 LDKStaticPaymentOutputDescriptor this_ptr_conv;
26526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26527 this_ptr_conv.is_owned = false;
26528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26529 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26532 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) {
26533 LDKOutPoint outpoint_arg_conv;
26534 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
26535 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
26536 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26537 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26538 void* output_arg_ptr = (void*)(((uintptr_t)output_arg) & ~1);
26539 CHECK_ACCESS(output_arg_ptr);
26540 LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26541 output_arg_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output_arg) & ~1));
26542 LDKThirtyTwoBytes channel_keys_id_arg_ref;
26543 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
26544 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
26545 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26546 int64_t ret_ref = 0;
26547 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26548 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26549 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26550 ret_ref = (uintptr_t)ret_var.inner;
26551 if (ret_var.is_owned) {
26557 static inline uintptr_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26558 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26559 int64_t ret_ref = 0;
26560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26563 ret_ref = (uintptr_t)ret_var.inner;
26564 if (ret_var.is_owned) {
26569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26570 LDKStaticPaymentOutputDescriptor arg_conv;
26571 arg_conv.inner = (void*)(arg & (~1));
26572 arg_conv.is_owned = false;
26573 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26574 int64_t ret_val = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26579 LDKStaticPaymentOutputDescriptor orig_conv;
26580 orig_conv.inner = (void*)(orig & (~1));
26581 orig_conv.is_owned = false;
26582 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26583 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26584 int64_t ret_ref = 0;
26585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26588 ret_ref = (uintptr_t)ret_var.inner;
26589 if (ret_var.is_owned) {
26595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26596 LDKStaticPaymentOutputDescriptor obj_conv;
26597 obj_conv.inner = (void*)(obj & (~1));
26598 obj_conv.is_owned = false;
26599 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26600 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26601 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26602 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26603 CVec_u8Z_free(ret_var);
26607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26608 LDKu8slice ser_ref;
26609 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26610 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26611 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26612 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26613 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26614 return (int64_t)ret_conv;
26617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26618 if ((this_ptr & 1) != 0) return;
26619 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26620 CHECK_ACCESS(this_ptr_ptr);
26621 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26622 FREE((void*)this_ptr);
26623 SpendableOutputDescriptor_free(this_ptr_conv);
26626 static inline uintptr_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
26627 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26628 *ret_copy = SpendableOutputDescriptor_clone(arg);
26629 int64_t ret_ref = (uintptr_t)ret_copy;
26632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26633 LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)arg;
26634 int64_t ret_val = SpendableOutputDescriptor_clone_ptr(arg_conv);
26638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26639 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
26640 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26641 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
26642 int64_t ret_ref = (uintptr_t)ret_copy;
26646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
26647 LDKOutPoint outpoint_conv;
26648 outpoint_conv.inner = (void*)(outpoint & (~1));
26649 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
26650 CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
26651 outpoint_conv = OutPoint_clone(&outpoint_conv);
26652 void* output_ptr = (void*)(((uintptr_t)output) & ~1);
26653 CHECK_ACCESS(output_ptr);
26654 LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
26655 output_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)output) & ~1));
26656 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26657 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
26658 int64_t ret_ref = (uintptr_t)ret_copy;
26662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
26663 LDKDelayedPaymentOutputDescriptor a_conv;
26664 a_conv.inner = (void*)(a & (~1));
26665 a_conv.is_owned = (a & 1) || (a == 0);
26666 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26667 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
26668 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26669 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
26670 int64_t ret_ref = (uintptr_t)ret_copy;
26674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
26675 LDKStaticPaymentOutputDescriptor a_conv;
26676 a_conv.inner = (void*)(a & (~1));
26677 a_conv.is_owned = (a & 1) || (a == 0);
26678 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26679 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
26680 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26681 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
26682 int64_t ret_ref = (uintptr_t)ret_copy;
26686 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
26687 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
26688 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
26689 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26690 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26691 CVec_u8Z_free(ret_var);
26695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26696 LDKu8slice ser_ref;
26697 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26698 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26699 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
26700 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
26701 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26702 return (int64_t)ret_conv;
26705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26706 if ((this_ptr & 1) != 0) return;
26707 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26708 CHECK_ACCESS(this_ptr_ptr);
26709 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
26710 FREE((void*)this_ptr);
26711 BaseSign_free(this_ptr_conv);
26714 static inline uintptr_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
26715 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26716 *ret_ret = Sign_clone(arg);
26717 return (int64_t)ret_ret;
26719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26720 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
26721 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
26722 LDKSign* arg_conv = (LDKSign*)arg_ptr;
26723 int64_t ret_val = Sign_clone_ptr(arg_conv);
26727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26728 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
26729 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
26730 LDKSign* orig_conv = (LDKSign*)orig_ptr;
26731 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26732 *ret_ret = Sign_clone(orig_conv);
26733 return (int64_t)ret_ret;
26736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26737 if ((this_ptr & 1) != 0) return;
26738 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26739 CHECK_ACCESS(this_ptr_ptr);
26740 LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
26741 FREE((void*)this_ptr);
26742 Sign_free(this_ptr_conv);
26745 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26746 LDKRecipient* orig_conv = (LDKRecipient*)(orig & ~1);
26747 jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
26751 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
26752 jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
26756 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
26757 jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
26761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26762 if ((this_ptr & 1) != 0) return;
26763 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
26764 CHECK_ACCESS(this_ptr_ptr);
26765 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
26766 FREE((void*)this_ptr);
26767 KeysInterface_free(this_ptr_conv);
26770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26771 LDKInMemorySigner this_obj_conv;
26772 this_obj_conv.inner = (void*)(this_obj & (~1));
26773 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26775 InMemorySigner_free(this_obj_conv);
26778 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
26779 LDKInMemorySigner this_ptr_conv;
26780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26781 this_ptr_conv.is_owned = false;
26782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26783 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26784 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
26788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26789 LDKInMemorySigner this_ptr_conv;
26790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26791 this_ptr_conv.is_owned = false;
26792 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26793 LDKSecretKey val_ref;
26794 CHECK((*env)->GetArrayLength(env, val) == 32);
26795 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
26796 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
26799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
26800 LDKInMemorySigner this_ptr_conv;
26801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26802 this_ptr_conv.is_owned = false;
26803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26804 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26805 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
26809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26810 LDKInMemorySigner this_ptr_conv;
26811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26812 this_ptr_conv.is_owned = false;
26813 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26814 LDKSecretKey val_ref;
26815 CHECK((*env)->GetArrayLength(env, val) == 32);
26816 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
26817 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
26820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
26821 LDKInMemorySigner this_ptr_conv;
26822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26823 this_ptr_conv.is_owned = false;
26824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26825 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26826 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
26830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26831 LDKInMemorySigner this_ptr_conv;
26832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26833 this_ptr_conv.is_owned = false;
26834 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26835 LDKSecretKey val_ref;
26836 CHECK((*env)->GetArrayLength(env, val) == 32);
26837 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
26838 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
26841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
26842 LDKInMemorySigner this_ptr_conv;
26843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26844 this_ptr_conv.is_owned = false;
26845 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26846 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26847 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
26851 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) {
26852 LDKInMemorySigner this_ptr_conv;
26853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26854 this_ptr_conv.is_owned = false;
26855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26856 LDKSecretKey val_ref;
26857 CHECK((*env)->GetArrayLength(env, val) == 32);
26858 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
26859 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
26862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
26863 LDKInMemorySigner this_ptr_conv;
26864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26865 this_ptr_conv.is_owned = false;
26866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26867 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26868 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
26872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26873 LDKInMemorySigner this_ptr_conv;
26874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26875 this_ptr_conv.is_owned = false;
26876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26877 LDKSecretKey val_ref;
26878 CHECK((*env)->GetArrayLength(env, val) == 32);
26879 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
26880 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
26883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
26884 LDKInMemorySigner this_ptr_conv;
26885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26886 this_ptr_conv.is_owned = false;
26887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26888 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26889 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
26893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26894 LDKInMemorySigner this_ptr_conv;
26895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26896 this_ptr_conv.is_owned = false;
26897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26898 LDKThirtyTwoBytes val_ref;
26899 CHECK((*env)->GetArrayLength(env, val) == 32);
26900 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
26901 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
26904 static inline uintptr_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
26905 LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
26906 int64_t ret_ref = 0;
26907 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26908 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26909 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26910 ret_ref = (uintptr_t)ret_var.inner;
26911 if (ret_var.is_owned) {
26916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26917 LDKInMemorySigner arg_conv;
26918 arg_conv.inner = (void*)(arg & (~1));
26919 arg_conv.is_owned = false;
26920 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26921 int64_t ret_val = InMemorySigner_clone_ptr(&arg_conv);
26925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26926 LDKInMemorySigner orig_conv;
26927 orig_conv.inner = (void*)(orig & (~1));
26928 orig_conv.is_owned = false;
26929 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26930 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
26931 int64_t ret_ref = 0;
26932 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26933 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26934 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26935 ret_ref = (uintptr_t)ret_var.inner;
26936 if (ret_var.is_owned) {
26942 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) {
26943 LDKSecretKey node_secret_ref;
26944 CHECK((*env)->GetArrayLength(env, node_secret) == 32);
26945 (*env)->GetByteArrayRegion(env, node_secret, 0, 32, node_secret_ref.bytes);
26946 LDKSecretKey funding_key_ref;
26947 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
26948 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
26949 LDKSecretKey revocation_base_key_ref;
26950 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
26951 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
26952 LDKSecretKey payment_key_ref;
26953 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
26954 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
26955 LDKSecretKey delayed_payment_base_key_ref;
26956 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
26957 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
26958 LDKSecretKey htlc_base_key_ref;
26959 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
26960 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
26961 LDKThirtyTwoBytes commitment_seed_ref;
26962 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
26963 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
26964 LDKThirtyTwoBytes channel_keys_id_ref;
26965 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
26966 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
26967 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);
26968 int64_t ret_ref = 0;
26969 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26970 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26971 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26972 ret_ref = (uintptr_t)ret_var.inner;
26973 if (ret_var.is_owned) {
26979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
26980 LDKInMemorySigner this_arg_conv;
26981 this_arg_conv.inner = (void*)(this_arg & (~1));
26982 this_arg_conv.is_owned = false;
26983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26984 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
26985 int64_t ret_ref = 0;
26986 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26987 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26988 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26989 ret_ref = (uintptr_t)ret_var.inner;
26990 if (ret_var.is_owned) {
26996 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
26997 LDKInMemorySigner this_arg_conv;
26998 this_arg_conv.inner = (void*)(this_arg & (~1));
26999 this_arg_conv.is_owned = false;
27000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27001 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
27005 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
27006 LDKInMemorySigner this_arg_conv;
27007 this_arg_conv.inner = (void*)(this_arg & (~1));
27008 this_arg_conv.is_owned = false;
27009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27010 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
27014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
27015 LDKInMemorySigner this_arg_conv;
27016 this_arg_conv.inner = (void*)(this_arg & (~1));
27017 this_arg_conv.is_owned = false;
27018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27019 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
27023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
27024 LDKInMemorySigner this_arg_conv;
27025 this_arg_conv.inner = (void*)(this_arg & (~1));
27026 this_arg_conv.is_owned = false;
27027 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27028 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
27029 int64_t ret_ref = 0;
27030 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27031 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27032 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27033 ret_ref = (uintptr_t)ret_var.inner;
27034 if (ret_var.is_owned) {
27040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
27041 LDKInMemorySigner this_arg_conv;
27042 this_arg_conv.inner = (void*)(this_arg & (~1));
27043 this_arg_conv.is_owned = false;
27044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27045 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
27046 int64_t ret_ref = 0;
27047 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27048 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27049 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27050 ret_ref = (uintptr_t)ret_var.inner;
27051 if (ret_var.is_owned) {
27057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
27058 LDKInMemorySigner this_arg_conv;
27059 this_arg_conv.inner = (void*)(this_arg & (~1));
27060 this_arg_conv.is_owned = false;
27061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27062 jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv);
27066 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) {
27067 LDKInMemorySigner this_arg_conv;
27068 this_arg_conv.inner = (void*)(this_arg & (~1));
27069 this_arg_conv.is_owned = false;
27070 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27071 LDKTransaction spend_tx_ref;
27072 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27073 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27074 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27075 spend_tx_ref.data_is_owned = true;
27076 LDKStaticPaymentOutputDescriptor descriptor_conv;
27077 descriptor_conv.inner = (void*)(descriptor & (~1));
27078 descriptor_conv.is_owned = false;
27079 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27080 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27081 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27082 return (int64_t)ret_conv;
27085 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) {
27086 LDKInMemorySigner this_arg_conv;
27087 this_arg_conv.inner = (void*)(this_arg & (~1));
27088 this_arg_conv.is_owned = false;
27089 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27090 LDKTransaction spend_tx_ref;
27091 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
27092 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
27093 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
27094 spend_tx_ref.data_is_owned = true;
27095 LDKDelayedPaymentOutputDescriptor descriptor_conv;
27096 descriptor_conv.inner = (void*)(descriptor & (~1));
27097 descriptor_conv.is_owned = false;
27098 CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
27099 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
27100 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
27101 return (int64_t)ret_conv;
27104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
27105 LDKInMemorySigner this_arg_conv;
27106 this_arg_conv.inner = (void*)(this_arg & (~1));
27107 this_arg_conv.is_owned = false;
27108 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27109 LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
27110 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
27111 return (int64_t)ret_ret;
27114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
27115 LDKInMemorySigner this_arg_conv;
27116 this_arg_conv.inner = (void*)(this_arg & (~1));
27117 this_arg_conv.is_owned = false;
27118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27119 LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
27120 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
27121 return (int64_t)ret_ret;
27124 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
27125 LDKInMemorySigner obj_conv;
27126 obj_conv.inner = (void*)(obj & (~1));
27127 obj_conv.is_owned = false;
27128 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27129 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
27130 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27131 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27132 CVec_u8Z_free(ret_var);
27136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int8_tArray arg) {
27137 LDKu8slice ser_ref;
27138 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27139 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27140 LDKSecretKey arg_ref;
27141 CHECK((*env)->GetArrayLength(env, arg) == 32);
27142 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
27143 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
27144 *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
27145 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27146 return (int64_t)ret_conv;
27149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27150 LDKKeysManager this_obj_conv;
27151 this_obj_conv.inner = (void*)(this_obj & (~1));
27152 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27153 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27154 KeysManager_free(this_obj_conv);
27157 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) {
27158 unsigned char seed_arr[32];
27159 CHECK((*env)->GetArrayLength(env, seed) == 32);
27160 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27161 unsigned char (*seed_ref)[32] = &seed_arr;
27162 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
27163 int64_t ret_ref = 0;
27164 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27165 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27166 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27167 ret_ref = (uintptr_t)ret_var.inner;
27168 if (ret_var.is_owned) {
27174 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) {
27175 LDKKeysManager this_arg_conv;
27176 this_arg_conv.inner = (void*)(this_arg & (~1));
27177 this_arg_conv.is_owned = false;
27178 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27179 unsigned char params_arr[32];
27180 CHECK((*env)->GetArrayLength(env, params) == 32);
27181 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27182 unsigned char (*params_ref)[32] = ¶ms_arr;
27183 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27184 int64_t ret_ref = 0;
27185 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27186 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27187 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27188 ret_ref = (uintptr_t)ret_var.inner;
27189 if (ret_var.is_owned) {
27195 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) {
27196 LDKKeysManager this_arg_conv;
27197 this_arg_conv.inner = (void*)(this_arg & (~1));
27198 this_arg_conv.is_owned = false;
27199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27200 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27201 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
27202 if (descriptors_constr.datalen > 0)
27203 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27205 descriptors_constr.data = NULL;
27206 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
27207 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27208 int64_t descriptors_conv_27 = descriptors_vals[b];
27209 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
27210 CHECK_ACCESS(descriptors_conv_27_ptr);
27211 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27212 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
27213 descriptors_constr.data[b] = descriptors_conv_27_conv;
27215 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
27216 LDKCVec_TxOutZ outputs_constr;
27217 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
27218 if (outputs_constr.datalen > 0)
27219 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27221 outputs_constr.data = NULL;
27222 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
27223 for (size_t h = 0; h < outputs_constr.datalen; h++) {
27224 int64_t outputs_conv_7 = outputs_vals[h];
27225 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
27226 CHECK_ACCESS(outputs_conv_7_ptr);
27227 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27228 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
27229 outputs_constr.data[h] = outputs_conv_7_conv;
27231 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
27232 LDKCVec_u8Z change_destination_script_ref;
27233 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
27234 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27235 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
27236 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27237 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27238 return (int64_t)ret_conv;
27241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
27242 LDKKeysManager this_arg_conv;
27243 this_arg_conv.inner = (void*)(this_arg & (~1));
27244 this_arg_conv.is_owned = false;
27245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27246 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
27247 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
27248 return (int64_t)ret_ret;
27251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27252 LDKPhantomKeysManager this_obj_conv;
27253 this_obj_conv.inner = (void*)(this_obj & (~1));
27254 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27256 PhantomKeysManager_free(this_obj_conv);
27259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
27260 LDKPhantomKeysManager this_arg_conv;
27261 this_arg_conv.inner = (void*)(this_arg & (~1));
27262 this_arg_conv.is_owned = false;
27263 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27264 LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
27265 *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
27266 return (int64_t)ret_ret;
27269 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) {
27270 unsigned char seed_arr[32];
27271 CHECK((*env)->GetArrayLength(env, seed) == 32);
27272 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
27273 unsigned char (*seed_ref)[32] = &seed_arr;
27274 unsigned char cross_node_seed_arr[32];
27275 CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
27276 (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
27277 unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
27278 LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
27279 int64_t ret_ref = 0;
27280 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27281 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27282 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27283 ret_ref = (uintptr_t)ret_var.inner;
27284 if (ret_var.is_owned) {
27290 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) {
27291 LDKPhantomKeysManager this_arg_conv;
27292 this_arg_conv.inner = (void*)(this_arg & (~1));
27293 this_arg_conv.is_owned = false;
27294 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27295 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
27296 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
27297 if (descriptors_constr.datalen > 0)
27298 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
27300 descriptors_constr.data = NULL;
27301 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
27302 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
27303 int64_t descriptors_conv_27 = descriptors_vals[b];
27304 void* descriptors_conv_27_ptr = (void*)(((uintptr_t)descriptors_conv_27) & ~1);
27305 CHECK_ACCESS(descriptors_conv_27_ptr);
27306 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
27307 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uintptr_t)descriptors_conv_27) & ~1));
27308 descriptors_constr.data[b] = descriptors_conv_27_conv;
27310 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
27311 LDKCVec_TxOutZ outputs_constr;
27312 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
27313 if (outputs_constr.datalen > 0)
27314 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
27316 outputs_constr.data = NULL;
27317 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
27318 for (size_t h = 0; h < outputs_constr.datalen; h++) {
27319 int64_t outputs_conv_7 = outputs_vals[h];
27320 void* outputs_conv_7_ptr = (void*)(((uintptr_t)outputs_conv_7) & ~1);
27321 CHECK_ACCESS(outputs_conv_7_ptr);
27322 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
27323 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uintptr_t)outputs_conv_7) & ~1));
27324 outputs_constr.data[h] = outputs_conv_7_conv;
27326 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
27327 LDKCVec_u8Z change_destination_script_ref;
27328 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
27329 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
27330 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
27331 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
27332 *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
27333 return (int64_t)ret_conv;
27336 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) {
27337 LDKPhantomKeysManager this_arg_conv;
27338 this_arg_conv.inner = (void*)(this_arg & (~1));
27339 this_arg_conv.is_owned = false;
27340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27341 unsigned char params_arr[32];
27342 CHECK((*env)->GetArrayLength(env, params) == 32);
27343 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
27344 unsigned char (*params_ref)[32] = ¶ms_arr;
27345 LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
27346 int64_t ret_ref = 0;
27347 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27348 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27349 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27350 ret_ref = (uintptr_t)ret_var.inner;
27351 if (ret_var.is_owned) {
27357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27358 LDKChannelManager this_obj_conv;
27359 this_obj_conv.inner = (void*)(this_obj & (~1));
27360 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27361 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27362 ChannelManager_free(this_obj_conv);
27365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27366 LDKChainParameters this_obj_conv;
27367 this_obj_conv.inner = (void*)(this_obj & (~1));
27368 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27369 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27370 ChainParameters_free(this_obj_conv);
27373 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
27374 LDKChainParameters this_ptr_conv;
27375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27376 this_ptr_conv.is_owned = false;
27377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27378 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
27382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
27383 LDKChainParameters this_ptr_conv;
27384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27385 this_ptr_conv.is_owned = false;
27386 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27387 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
27388 ChainParameters_set_network(&this_ptr_conv, val_conv);
27391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
27392 LDKChainParameters this_ptr_conv;
27393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27394 this_ptr_conv.is_owned = false;
27395 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27396 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
27397 int64_t ret_ref = 0;
27398 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27399 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27400 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27401 ret_ref = (uintptr_t)ret_var.inner;
27402 if (ret_var.is_owned) {
27408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27409 LDKChainParameters this_ptr_conv;
27410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27411 this_ptr_conv.is_owned = false;
27412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27413 LDKBestBlock val_conv;
27414 val_conv.inner = (void*)(val & (~1));
27415 val_conv.is_owned = (val & 1) || (val == 0);
27416 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27417 val_conv = BestBlock_clone(&val_conv);
27418 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
27422 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
27423 LDKBestBlock best_block_arg_conv;
27424 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
27425 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
27426 CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27427 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27428 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27429 int64_t ret_ref = 0;
27430 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27431 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27432 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27433 ret_ref = (uintptr_t)ret_var.inner;
27434 if (ret_var.is_owned) {
27440 static inline uintptr_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27441 LDKChainParameters ret_var = ChainParameters_clone(arg);
27442 int64_t ret_ref = 0;
27443 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27444 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27446 ret_ref = (uintptr_t)ret_var.inner;
27447 if (ret_var.is_owned) {
27452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27453 LDKChainParameters arg_conv;
27454 arg_conv.inner = (void*)(arg & (~1));
27455 arg_conv.is_owned = false;
27456 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27457 int64_t ret_val = ChainParameters_clone_ptr(&arg_conv);
27461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27462 LDKChainParameters orig_conv;
27463 orig_conv.inner = (void*)(orig & (~1));
27464 orig_conv.is_owned = false;
27465 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27466 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27467 int64_t ret_ref = 0;
27468 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27469 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27471 ret_ref = (uintptr_t)ret_var.inner;
27472 if (ret_var.is_owned) {
27478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27479 LDKCounterpartyForwardingInfo this_obj_conv;
27480 this_obj_conv.inner = (void*)(this_obj & (~1));
27481 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27483 CounterpartyForwardingInfo_free(this_obj_conv);
27486 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27487 LDKCounterpartyForwardingInfo this_ptr_conv;
27488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27489 this_ptr_conv.is_owned = false;
27490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27491 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27496 LDKCounterpartyForwardingInfo this_ptr_conv;
27497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27498 this_ptr_conv.is_owned = false;
27499 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27500 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27503 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
27504 LDKCounterpartyForwardingInfo this_ptr_conv;
27505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27506 this_ptr_conv.is_owned = false;
27507 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27508 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27513 LDKCounterpartyForwardingInfo this_ptr_conv;
27514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27515 this_ptr_conv.is_owned = false;
27516 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27517 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27520 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
27521 LDKCounterpartyForwardingInfo this_ptr_conv;
27522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27523 this_ptr_conv.is_owned = false;
27524 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27525 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27530 LDKCounterpartyForwardingInfo this_ptr_conv;
27531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27532 this_ptr_conv.is_owned = false;
27533 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27534 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27537 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) {
27538 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27539 int64_t ret_ref = 0;
27540 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27541 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27542 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27543 ret_ref = (uintptr_t)ret_var.inner;
27544 if (ret_var.is_owned) {
27550 static inline uintptr_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27551 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27552 int64_t ret_ref = 0;
27553 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27554 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27555 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27556 ret_ref = (uintptr_t)ret_var.inner;
27557 if (ret_var.is_owned) {
27562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27563 LDKCounterpartyForwardingInfo arg_conv;
27564 arg_conv.inner = (void*)(arg & (~1));
27565 arg_conv.is_owned = false;
27566 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27567 int64_t ret_val = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27572 LDKCounterpartyForwardingInfo orig_conv;
27573 orig_conv.inner = (void*)(orig & (~1));
27574 orig_conv.is_owned = false;
27575 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27576 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27577 int64_t ret_ref = 0;
27578 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27579 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27580 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27581 ret_ref = (uintptr_t)ret_var.inner;
27582 if (ret_var.is_owned) {
27588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27589 LDKChannelCounterparty this_obj_conv;
27590 this_obj_conv.inner = (void*)(this_obj & (~1));
27591 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27592 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27593 ChannelCounterparty_free(this_obj_conv);
27596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27597 LDKChannelCounterparty this_ptr_conv;
27598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27599 this_ptr_conv.is_owned = false;
27600 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27601 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27602 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
27606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27607 LDKChannelCounterparty this_ptr_conv;
27608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27609 this_ptr_conv.is_owned = false;
27610 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27611 LDKPublicKey val_ref;
27612 CHECK((*env)->GetArrayLength(env, val) == 33);
27613 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27614 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27618 LDKChannelCounterparty this_ptr_conv;
27619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27620 this_ptr_conv.is_owned = false;
27621 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27622 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27623 int64_t ret_ref = 0;
27624 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27625 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27626 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27627 ret_ref = (uintptr_t)ret_var.inner;
27628 if (ret_var.is_owned) {
27634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27635 LDKChannelCounterparty this_ptr_conv;
27636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27637 this_ptr_conv.is_owned = false;
27638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27639 LDKInitFeatures val_conv;
27640 val_conv.inner = (void*)(val & (~1));
27641 val_conv.is_owned = (val & 1) || (val == 0);
27642 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27643 val_conv = InitFeatures_clone(&val_conv);
27644 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
27647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
27648 LDKChannelCounterparty this_ptr_conv;
27649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27650 this_ptr_conv.is_owned = false;
27651 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27652 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
27656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27657 LDKChannelCounterparty this_ptr_conv;
27658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27659 this_ptr_conv.is_owned = false;
27660 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27661 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
27664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
27665 LDKChannelCounterparty this_ptr_conv;
27666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27667 this_ptr_conv.is_owned = false;
27668 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27669 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
27670 int64_t ret_ref = 0;
27671 if ((uintptr_t)ret_var.inner > 4096) {
27672 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27673 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27675 ret_ref = (uintptr_t)ret_var.inner;
27676 if (ret_var.is_owned) {
27683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27684 LDKChannelCounterparty this_ptr_conv;
27685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27686 this_ptr_conv.is_owned = false;
27687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27688 LDKCounterpartyForwardingInfo val_conv;
27689 val_conv.inner = (void*)(val & (~1));
27690 val_conv.is_owned = (val & 1) || (val == 0);
27691 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27692 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
27693 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
27696 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) {
27697 LDKPublicKey node_id_arg_ref;
27698 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
27699 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
27700 LDKInitFeatures features_arg_conv;
27701 features_arg_conv.inner = (void*)(features_arg & (~1));
27702 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27703 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27704 features_arg_conv = InitFeatures_clone(&features_arg_conv);
27705 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
27706 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
27707 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
27708 CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
27709 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
27710 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
27711 int64_t ret_ref = 0;
27712 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27713 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27714 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27715 ret_ref = (uintptr_t)ret_var.inner;
27716 if (ret_var.is_owned) {
27722 static inline uintptr_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
27723 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
27724 int64_t ret_ref = 0;
27725 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27726 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27727 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27728 ret_ref = (uintptr_t)ret_var.inner;
27729 if (ret_var.is_owned) {
27734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27735 LDKChannelCounterparty arg_conv;
27736 arg_conv.inner = (void*)(arg & (~1));
27737 arg_conv.is_owned = false;
27738 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27739 int64_t ret_val = ChannelCounterparty_clone_ptr(&arg_conv);
27743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27744 LDKChannelCounterparty orig_conv;
27745 orig_conv.inner = (void*)(orig & (~1));
27746 orig_conv.is_owned = false;
27747 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27748 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
27749 int64_t ret_ref = 0;
27750 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27751 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27752 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27753 ret_ref = (uintptr_t)ret_var.inner;
27754 if (ret_var.is_owned) {
27760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27761 LDKChannelDetails this_obj_conv;
27762 this_obj_conv.inner = (void*)(this_obj & (~1));
27763 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27764 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27765 ChannelDetails_free(this_obj_conv);
27768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27769 LDKChannelDetails this_ptr_conv;
27770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27771 this_ptr_conv.is_owned = false;
27772 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27773 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27774 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
27778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27779 LDKChannelDetails this_ptr_conv;
27780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27781 this_ptr_conv.is_owned = false;
27782 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27783 LDKThirtyTwoBytes val_ref;
27784 CHECK((*env)->GetArrayLength(env, val) == 32);
27785 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27786 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
27789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
27790 LDKChannelDetails this_ptr_conv;
27791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27792 this_ptr_conv.is_owned = false;
27793 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27794 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
27795 int64_t ret_ref = 0;
27796 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27797 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27798 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27799 ret_ref = (uintptr_t)ret_var.inner;
27800 if (ret_var.is_owned) {
27806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27807 LDKChannelDetails this_ptr_conv;
27808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27809 this_ptr_conv.is_owned = false;
27810 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27811 LDKChannelCounterparty val_conv;
27812 val_conv.inner = (void*)(val & (~1));
27813 val_conv.is_owned = (val & 1) || (val == 0);
27814 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27815 val_conv = ChannelCounterparty_clone(&val_conv);
27816 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
27819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
27820 LDKChannelDetails this_ptr_conv;
27821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27822 this_ptr_conv.is_owned = false;
27823 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27824 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
27825 int64_t ret_ref = 0;
27826 if ((uintptr_t)ret_var.inner > 4096) {
27827 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27828 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27830 ret_ref = (uintptr_t)ret_var.inner;
27831 if (ret_var.is_owned) {
27838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27839 LDKChannelDetails this_ptr_conv;
27840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27841 this_ptr_conv.is_owned = false;
27842 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27843 LDKOutPoint val_conv;
27844 val_conv.inner = (void*)(val & (~1));
27845 val_conv.is_owned = (val & 1) || (val == 0);
27846 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27847 val_conv = OutPoint_clone(&val_conv);
27848 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
27851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27852 LDKChannelDetails this_ptr_conv;
27853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27854 this_ptr_conv.is_owned = false;
27855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27856 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27857 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
27858 int64_t ret_ref = (uintptr_t)ret_copy;
27862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27863 LDKChannelDetails this_ptr_conv;
27864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27865 this_ptr_conv.is_owned = false;
27866 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27867 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27868 CHECK_ACCESS(val_ptr);
27869 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27870 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
27871 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
27874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
27875 LDKChannelDetails this_ptr_conv;
27876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27877 this_ptr_conv.is_owned = false;
27878 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27879 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
27883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27884 LDKChannelDetails this_ptr_conv;
27885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27886 this_ptr_conv.is_owned = false;
27887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27888 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
27891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
27892 LDKChannelDetails this_ptr_conv;
27893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27894 this_ptr_conv.is_owned = false;
27895 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27896 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27897 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
27898 int64_t ret_ref = (uintptr_t)ret_copy;
27902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27903 LDKChannelDetails this_ptr_conv;
27904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27905 this_ptr_conv.is_owned = false;
27906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27907 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27908 CHECK_ACCESS(val_ptr);
27909 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27910 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
27911 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
27914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
27915 LDKChannelDetails this_ptr_conv;
27916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27917 this_ptr_conv.is_owned = false;
27918 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27919 int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv);
27923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27924 LDKChannelDetails this_ptr_conv;
27925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27926 this_ptr_conv.is_owned = false;
27927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27928 ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
27931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27932 LDKChannelDetails this_ptr_conv;
27933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27934 this_ptr_conv.is_owned = false;
27935 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27936 int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv);
27940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27941 LDKChannelDetails this_ptr_conv;
27942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27943 this_ptr_conv.is_owned = false;
27944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27945 ChannelDetails_set_balance_msat(&this_ptr_conv, val);
27948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27949 LDKChannelDetails this_ptr_conv;
27950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27951 this_ptr_conv.is_owned = false;
27952 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27953 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
27957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27958 LDKChannelDetails this_ptr_conv;
27959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27960 this_ptr_conv.is_owned = false;
27961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27962 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
27965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27966 LDKChannelDetails this_ptr_conv;
27967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27968 this_ptr_conv.is_owned = false;
27969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27970 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
27974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27975 LDKChannelDetails this_ptr_conv;
27976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27977 this_ptr_conv.is_owned = false;
27978 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27979 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
27982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
27983 LDKChannelDetails this_ptr_conv;
27984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27985 this_ptr_conv.is_owned = false;
27986 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27987 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
27988 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
27989 int64_t ret_ref = (uintptr_t)ret_copy;
27993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27994 LDKChannelDetails this_ptr_conv;
27995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27996 this_ptr_conv.is_owned = false;
27997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27998 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
27999 CHECK_ACCESS(val_ptr);
28000 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
28001 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
28002 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
28005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
28006 LDKChannelDetails this_ptr_conv;
28007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28008 this_ptr_conv.is_owned = false;
28009 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28010 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
28011 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
28012 int64_t ret_ref = (uintptr_t)ret_copy;
28016 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) {
28017 LDKChannelDetails this_ptr_conv;
28018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28019 this_ptr_conv.is_owned = false;
28020 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28021 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
28022 CHECK_ACCESS(val_ptr);
28023 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
28024 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)val) & ~1));
28025 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
28028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
28029 LDKChannelDetails this_ptr_conv;
28030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28031 this_ptr_conv.is_owned = false;
28032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28033 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
28037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28038 LDKChannelDetails this_ptr_conv;
28039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28040 this_ptr_conv.is_owned = false;
28041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28042 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
28045 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
28046 LDKChannelDetails this_ptr_conv;
28047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28048 this_ptr_conv.is_owned = false;
28049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28050 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
28054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28055 LDKChannelDetails this_ptr_conv;
28056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28057 this_ptr_conv.is_owned = false;
28058 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28059 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
28062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
28063 LDKChannelDetails this_ptr_conv;
28064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28065 this_ptr_conv.is_owned = false;
28066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28067 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
28071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28072 LDKChannelDetails this_ptr_conv;
28073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28074 this_ptr_conv.is_owned = false;
28075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28076 ChannelDetails_set_is_usable(&this_ptr_conv, val);
28079 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
28080 LDKChannelDetails this_ptr_conv;
28081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28082 this_ptr_conv.is_owned = false;
28083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28084 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
28088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
28089 LDKChannelDetails this_ptr_conv;
28090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28091 this_ptr_conv.is_owned = false;
28092 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28093 ChannelDetails_set_is_public(&this_ptr_conv, val);
28096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
28097 LDKThirtyTwoBytes channel_id_arg_ref;
28098 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
28099 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
28100 LDKChannelCounterparty counterparty_arg_conv;
28101 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
28102 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
28103 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
28104 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
28105 LDKOutPoint funding_txo_arg_conv;
28106 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
28107 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
28108 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
28109 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
28110 void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1);
28111 CHECK_ACCESS(short_channel_id_arg_ptr);
28112 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
28113 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1));
28114 void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1);
28115 CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
28116 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
28117 void* confirmations_required_arg_ptr = (void*)(((uintptr_t)confirmations_required_arg) & ~1);
28118 CHECK_ACCESS(confirmations_required_arg_ptr);
28119 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
28120 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)confirmations_required_arg) & ~1));
28121 void* force_close_spend_delay_arg_ptr = (void*)(((uintptr_t)force_close_spend_delay_arg) & ~1);
28122 CHECK_ACCESS(force_close_spend_delay_arg_ptr);
28123 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
28124 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1));
28125 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
28126 int64_t ret_ref = 0;
28127 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28128 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28130 ret_ref = (uintptr_t)ret_var.inner;
28131 if (ret_var.is_owned) {
28137 static inline uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
28138 LDKChannelDetails ret_var = ChannelDetails_clone(arg);
28139 int64_t ret_ref = 0;
28140 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28141 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28142 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28143 ret_ref = (uintptr_t)ret_var.inner;
28144 if (ret_var.is_owned) {
28149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28150 LDKChannelDetails arg_conv;
28151 arg_conv.inner = (void*)(arg & (~1));
28152 arg_conv.is_owned = false;
28153 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28154 int64_t ret_val = ChannelDetails_clone_ptr(&arg_conv);
28158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28159 LDKChannelDetails orig_conv;
28160 orig_conv.inner = (void*)(orig & (~1));
28161 orig_conv.is_owned = false;
28162 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28163 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28164 int64_t ret_ref = 0;
28165 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28166 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28167 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28168 ret_ref = (uintptr_t)ret_var.inner;
28169 if (ret_var.is_owned) {
28175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28176 if ((this_ptr & 1) != 0) return;
28177 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
28178 CHECK_ACCESS(this_ptr_ptr);
28179 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
28180 FREE((void*)this_ptr);
28181 PaymentSendFailure_free(this_ptr_conv);
28184 static inline uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
28185 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28186 *ret_copy = PaymentSendFailure_clone(arg);
28187 int64_t ret_ref = (uintptr_t)ret_copy;
28190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28191 LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)arg;
28192 int64_t ret_val = PaymentSendFailure_clone_ptr(arg_conv);
28196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28197 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
28198 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28199 *ret_copy = PaymentSendFailure_clone(orig_conv);
28200 int64_t ret_ref = (uintptr_t)ret_copy;
28204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
28205 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
28206 CHECK_ACCESS(a_ptr);
28207 LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
28208 a_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a) & ~1));
28209 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28210 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
28211 int64_t ret_ref = (uintptr_t)ret_copy;
28215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
28216 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
28217 a_constr.datalen = (*env)->GetArrayLength(env, a);
28218 if (a_constr.datalen > 0)
28219 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28221 a_constr.data = NULL;
28222 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
28223 for (size_t w = 0; w < a_constr.datalen; w++) {
28224 int64_t a_conv_22 = a_vals[w];
28225 void* a_conv_22_ptr = (void*)(((uintptr_t)a_conv_22) & ~1);
28226 CHECK_ACCESS(a_conv_22_ptr);
28227 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
28228 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uintptr_t)a_conv_22) & ~1));
28229 a_constr.data[w] = a_conv_22_conv;
28231 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
28232 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28233 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
28234 int64_t ret_ref = (uintptr_t)ret_copy;
28238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
28239 LDKCVec_APIErrorZ a_constr;
28240 a_constr.datalen = (*env)->GetArrayLength(env, a);
28241 if (a_constr.datalen > 0)
28242 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
28244 a_constr.data = NULL;
28245 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
28246 for (size_t k = 0; k < a_constr.datalen; k++) {
28247 int64_t a_conv_10 = a_vals[k];
28248 void* a_conv_10_ptr = (void*)(((uintptr_t)a_conv_10) & ~1);
28249 CHECK_ACCESS(a_conv_10_ptr);
28250 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
28251 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uintptr_t)a_conv_10) & ~1));
28252 a_constr.data[k] = a_conv_10_conv;
28254 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
28255 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28256 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
28257 int64_t ret_ref = (uintptr_t)ret_copy;
28261 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) {
28262 LDKCVec_CResult_NoneAPIErrorZZ results_constr;
28263 results_constr.datalen = (*env)->GetArrayLength(env, results);
28264 if (results_constr.datalen > 0)
28265 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28267 results_constr.data = NULL;
28268 int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
28269 for (size_t w = 0; w < results_constr.datalen; w++) {
28270 int64_t results_conv_22 = results_vals[w];
28271 void* results_conv_22_ptr = (void*)(((uintptr_t)results_conv_22) & ~1);
28272 CHECK_ACCESS(results_conv_22_ptr);
28273 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
28274 results_constr.data[w] = results_conv_22_conv;
28276 (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
28277 LDKRouteParameters failed_paths_retry_conv;
28278 failed_paths_retry_conv.inner = (void*)(failed_paths_retry & (~1));
28279 failed_paths_retry_conv.is_owned = (failed_paths_retry & 1) || (failed_paths_retry == 0);
28280 CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
28281 failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
28282 LDKThirtyTwoBytes payment_id_ref;
28283 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
28284 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
28285 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28286 *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
28287 int64_t ret_ref = (uintptr_t)ret_copy;
28291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28292 LDKPhantomRouteHints this_obj_conv;
28293 this_obj_conv.inner = (void*)(this_obj & (~1));
28294 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28295 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28296 PhantomRouteHints_free(this_obj_conv);
28299 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
28300 LDKPhantomRouteHints this_ptr_conv;
28301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28302 this_ptr_conv.is_owned = false;
28303 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28304 LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28305 int64_tArray ret_arr = NULL;
28306 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28307 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28308 for (size_t q = 0; q < ret_var.datalen; q++) {
28309 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28310 int64_t ret_conv_16_ref = 0;
28311 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28312 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28313 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28314 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
28315 if (ret_conv_16_var.is_owned) {
28316 ret_conv_16_ref |= 1;
28318 ret_arr_ptr[q] = ret_conv_16_ref;
28320 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28321 FREE(ret_var.data);
28325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
28326 LDKPhantomRouteHints this_ptr_conv;
28327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28328 this_ptr_conv.is_owned = false;
28329 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28330 LDKCVec_ChannelDetailsZ val_constr;
28331 val_constr.datalen = (*env)->GetArrayLength(env, val);
28332 if (val_constr.datalen > 0)
28333 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28335 val_constr.data = NULL;
28336 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
28337 for (size_t q = 0; q < val_constr.datalen; q++) {
28338 int64_t val_conv_16 = val_vals[q];
28339 LDKChannelDetails val_conv_16_conv;
28340 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
28341 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
28342 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28343 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28344 val_constr.data[q] = val_conv_16_conv;
28346 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
28347 PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
28351 LDKPhantomRouteHints this_ptr_conv;
28352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28353 this_ptr_conv.is_owned = false;
28354 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28355 int64_t ret_val = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28360 LDKPhantomRouteHints this_ptr_conv;
28361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28362 this_ptr_conv.is_owned = false;
28363 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28364 PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
28368 LDKPhantomRouteHints this_ptr_conv;
28369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28370 this_ptr_conv.is_owned = false;
28371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28372 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28373 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
28377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
28378 LDKPhantomRouteHints this_ptr_conv;
28379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28380 this_ptr_conv.is_owned = false;
28381 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28382 LDKPublicKey val_ref;
28383 CHECK((*env)->GetArrayLength(env, val) == 33);
28384 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
28385 PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28388 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) {
28389 LDKCVec_ChannelDetailsZ channels_arg_constr;
28390 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
28391 if (channels_arg_constr.datalen > 0)
28392 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28394 channels_arg_constr.data = NULL;
28395 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
28396 for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28397 int64_t channels_arg_conv_16 = channels_arg_vals[q];
28398 LDKChannelDetails channels_arg_conv_16_conv;
28399 channels_arg_conv_16_conv.inner = (void*)(channels_arg_conv_16 & (~1));
28400 channels_arg_conv_16_conv.is_owned = (channels_arg_conv_16 & 1) || (channels_arg_conv_16 == 0);
28401 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28402 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28403 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28405 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
28406 LDKPublicKey real_node_pubkey_arg_ref;
28407 CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
28408 (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
28409 LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28410 int64_t ret_ref = 0;
28411 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28412 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28414 ret_ref = (uintptr_t)ret_var.inner;
28415 if (ret_var.is_owned) {
28421 static inline uintptr_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28422 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28423 int64_t ret_ref = 0;
28424 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28425 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28426 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28427 ret_ref = (uintptr_t)ret_var.inner;
28428 if (ret_var.is_owned) {
28433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28434 LDKPhantomRouteHints arg_conv;
28435 arg_conv.inner = (void*)(arg & (~1));
28436 arg_conv.is_owned = false;
28437 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28438 int64_t ret_val = PhantomRouteHints_clone_ptr(&arg_conv);
28442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28443 LDKPhantomRouteHints orig_conv;
28444 orig_conv.inner = (void*)(orig & (~1));
28445 orig_conv.is_owned = false;
28446 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28447 LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28448 int64_t ret_ref = 0;
28449 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28450 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28451 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28452 ret_ref = (uintptr_t)ret_var.inner;
28453 if (ret_var.is_owned) {
28459 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) {
28460 void* fee_est_ptr = (void*)(((uintptr_t)fee_est) & ~1);
28461 CHECK_ACCESS(fee_est_ptr);
28462 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28463 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28464 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28465 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28467 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
28468 CHECK_ACCESS(chain_monitor_ptr);
28469 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28470 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28471 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28472 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28474 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
28475 CHECK_ACCESS(tx_broadcaster_ptr);
28476 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28477 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28478 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28479 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28481 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
28482 CHECK_ACCESS(logger_ptr);
28483 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28484 if (logger_conv.free == LDKLogger_JCalls_free) {
28485 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28486 LDKLogger_JCalls_cloned(&logger_conv);
28488 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
28489 CHECK_ACCESS(keys_manager_ptr);
28490 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28491 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28492 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28493 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28495 LDKUserConfig config_conv;
28496 config_conv.inner = (void*)(config & (~1));
28497 config_conv.is_owned = (config & 1) || (config == 0);
28498 CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28499 config_conv = UserConfig_clone(&config_conv);
28500 LDKChainParameters params_conv;
28501 params_conv.inner = (void*)(params & (~1));
28502 params_conv.is_owned = (params & 1) || (params == 0);
28503 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28504 params_conv = ChainParameters_clone(¶ms_conv);
28505 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
28506 int64_t ret_ref = 0;
28507 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28508 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28509 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28510 ret_ref = (uintptr_t)ret_var.inner;
28511 if (ret_var.is_owned) {
28517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
28518 LDKChannelManager this_arg_conv;
28519 this_arg_conv.inner = (void*)(this_arg & (~1));
28520 this_arg_conv.is_owned = false;
28521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28522 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28523 int64_t ret_ref = 0;
28524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28527 ret_ref = (uintptr_t)ret_var.inner;
28528 if (ret_var.is_owned) {
28534 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) {
28535 LDKChannelManager this_arg_conv;
28536 this_arg_conv.inner = (void*)(this_arg & (~1));
28537 this_arg_conv.is_owned = false;
28538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28539 LDKPublicKey their_network_key_ref;
28540 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
28541 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
28542 LDKUserConfig override_config_conv;
28543 override_config_conv.inner = (void*)(override_config & (~1));
28544 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
28545 CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28546 override_config_conv = UserConfig_clone(&override_config_conv);
28547 LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28548 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
28549 return (int64_t)ret_conv;
28552 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
28553 LDKChannelManager this_arg_conv;
28554 this_arg_conv.inner = (void*)(this_arg & (~1));
28555 this_arg_conv.is_owned = false;
28556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28557 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
28558 int64_tArray ret_arr = NULL;
28559 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28560 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28561 for (size_t q = 0; q < ret_var.datalen; q++) {
28562 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28563 int64_t ret_conv_16_ref = 0;
28564 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28565 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28566 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28567 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
28568 if (ret_conv_16_var.is_owned) {
28569 ret_conv_16_ref |= 1;
28571 ret_arr_ptr[q] = ret_conv_16_ref;
28573 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28574 FREE(ret_var.data);
28578 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
28579 LDKChannelManager this_arg_conv;
28580 this_arg_conv.inner = (void*)(this_arg & (~1));
28581 this_arg_conv.is_owned = false;
28582 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28583 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
28584 int64_tArray ret_arr = NULL;
28585 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
28586 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
28587 for (size_t q = 0; q < ret_var.datalen; q++) {
28588 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28589 int64_t ret_conv_16_ref = 0;
28590 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28591 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28592 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28593 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
28594 if (ret_conv_16_var.is_owned) {
28595 ret_conv_16_ref |= 1;
28597 ret_arr_ptr[q] = ret_conv_16_ref;
28599 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
28600 FREE(ret_var.data);
28604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
28605 LDKChannelManager this_arg_conv;
28606 this_arg_conv.inner = (void*)(this_arg & (~1));
28607 this_arg_conv.is_owned = false;
28608 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28609 unsigned char channel_id_arr[32];
28610 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
28611 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
28612 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28613 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28614 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
28615 return (int64_t)ret_conv;
28618 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) {
28619 LDKChannelManager this_arg_conv;
28620 this_arg_conv.inner = (void*)(this_arg & (~1));
28621 this_arg_conv.is_owned = false;
28622 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28623 unsigned char channel_id_arr[32];
28624 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
28625 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
28626 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28627 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28628 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
28629 return (int64_t)ret_conv;
28632 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) {
28633 LDKChannelManager this_arg_conv;
28634 this_arg_conv.inner = (void*)(this_arg & (~1));
28635 this_arg_conv.is_owned = false;
28636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28637 unsigned char channel_id_arr[32];
28638 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
28639 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
28640 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28641 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28642 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
28643 return (int64_t)ret_conv;
28646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
28647 LDKChannelManager this_arg_conv;
28648 this_arg_conv.inner = (void*)(this_arg & (~1));
28649 this_arg_conv.is_owned = false;
28650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28651 ChannelManager_force_close_all_channels(&this_arg_conv);
28654 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) {
28655 LDKChannelManager this_arg_conv;
28656 this_arg_conv.inner = (void*)(this_arg & (~1));
28657 this_arg_conv.is_owned = false;
28658 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28659 LDKRoute route_conv;
28660 route_conv.inner = (void*)(route & (~1));
28661 route_conv.is_owned = false;
28662 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28663 LDKThirtyTwoBytes payment_hash_ref;
28664 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
28665 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
28666 LDKThirtyTwoBytes payment_secret_ref;
28667 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
28668 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
28669 LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
28670 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
28671 return (int64_t)ret_conv;
28674 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) {
28675 LDKChannelManager 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 LDKRoute route_conv;
28680 route_conv.inner = (void*)(route & (~1));
28681 route_conv.is_owned = false;
28682 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28683 LDKThirtyTwoBytes payment_id_ref;
28684 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
28685 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
28686 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
28687 *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
28688 return (int64_t)ret_conv;
28691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
28692 LDKChannelManager this_arg_conv;
28693 this_arg_conv.inner = (void*)(this_arg & (~1));
28694 this_arg_conv.is_owned = false;
28695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28696 LDKThirtyTwoBytes payment_id_ref;
28697 CHECK((*env)->GetArrayLength(env, payment_id) == 32);
28698 (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
28699 ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
28702 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) {
28703 LDKChannelManager this_arg_conv;
28704 this_arg_conv.inner = (void*)(this_arg & (~1));
28705 this_arg_conv.is_owned = false;
28706 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28707 LDKRoute route_conv;
28708 route_conv.inner = (void*)(route & (~1));
28709 route_conv.is_owned = false;
28710 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28711 LDKThirtyTwoBytes payment_preimage_ref;
28712 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
28713 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
28714 LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
28715 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
28716 return (int64_t)ret_conv;
28719 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) {
28720 LDKChannelManager this_arg_conv;
28721 this_arg_conv.inner = (void*)(this_arg & (~1));
28722 this_arg_conv.is_owned = false;
28723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28724 unsigned char temporary_channel_id_arr[32];
28725 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
28726 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
28727 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
28728 LDKTransaction funding_transaction_ref;
28729 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
28730 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
28731 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
28732 funding_transaction_ref.data_is_owned = true;
28733 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28734 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
28735 return (int64_t)ret_conv;
28738 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) {
28739 LDKChannelManager this_arg_conv;
28740 this_arg_conv.inner = (void*)(this_arg & (~1));
28741 this_arg_conv.is_owned = false;
28742 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28743 LDKThreeBytes rgb_ref;
28744 CHECK((*env)->GetArrayLength(env, rgb) == 3);
28745 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
28746 LDKThirtyTwoBytes alias_ref;
28747 CHECK((*env)->GetArrayLength(env, alias) == 32);
28748 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
28749 LDKCVec_NetAddressZ addresses_constr;
28750 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
28751 if (addresses_constr.datalen > 0)
28752 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
28754 addresses_constr.data = NULL;
28755 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
28756 for (size_t m = 0; m < addresses_constr.datalen; m++) {
28757 int64_t addresses_conv_12 = addresses_vals[m];
28758 void* addresses_conv_12_ptr = (void*)(((uintptr_t)addresses_conv_12) & ~1);
28759 CHECK_ACCESS(addresses_conv_12_ptr);
28760 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
28761 addresses_constr.data[m] = addresses_conv_12_conv;
28763 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
28764 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
28767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
28768 LDKChannelManager this_arg_conv;
28769 this_arg_conv.inner = (void*)(this_arg & (~1));
28770 this_arg_conv.is_owned = false;
28771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28772 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
28775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
28776 LDKChannelManager this_arg_conv;
28777 this_arg_conv.inner = (void*)(this_arg & (~1));
28778 this_arg_conv.is_owned = false;
28779 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28780 ChannelManager_timer_tick_occurred(&this_arg_conv);
28783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
28784 LDKChannelManager this_arg_conv;
28785 this_arg_conv.inner = (void*)(this_arg & (~1));
28786 this_arg_conv.is_owned = false;
28787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28788 unsigned char payment_hash_arr[32];
28789 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
28790 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
28791 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
28792 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
28796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
28797 LDKChannelManager this_arg_conv;
28798 this_arg_conv.inner = (void*)(this_arg & (~1));
28799 this_arg_conv.is_owned = false;
28800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28801 LDKThirtyTwoBytes payment_preimage_ref;
28802 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
28803 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
28804 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
28808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
28809 LDKChannelManager this_arg_conv;
28810 this_arg_conv.inner = (void*)(this_arg & (~1));
28811 this_arg_conv.is_owned = false;
28812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28813 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
28814 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
28818 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) {
28819 LDKChannelManager this_arg_conv;
28820 this_arg_conv.inner = (void*)(this_arg & (~1));
28821 this_arg_conv.is_owned = false;
28822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28823 unsigned char temporary_channel_id_arr[32];
28824 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
28825 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
28826 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
28827 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28828 *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref);
28829 return (int64_t)ret_conv;
28832 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) {
28833 LDKChannelManager this_arg_conv;
28834 this_arg_conv.inner = (void*)(this_arg & (~1));
28835 this_arg_conv.is_owned = false;
28836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28837 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
28838 CHECK_ACCESS(min_value_msat_ptr);
28839 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28840 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
28841 LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
28842 *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
28843 return (int64_t)ret_conv;
28846 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) {
28847 LDKChannelManager this_arg_conv;
28848 this_arg_conv.inner = (void*)(this_arg & (~1));
28849 this_arg_conv.is_owned = false;
28850 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28851 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
28852 CHECK_ACCESS(min_value_msat_ptr);
28853 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28854 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
28855 LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
28856 *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
28857 return (int64_t)ret_conv;
28860 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) {
28861 LDKChannelManager this_arg_conv;
28862 this_arg_conv.inner = (void*)(this_arg & (~1));
28863 this_arg_conv.is_owned = false;
28864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28865 LDKThirtyTwoBytes payment_hash_ref;
28866 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
28867 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
28868 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
28869 CHECK_ACCESS(min_value_msat_ptr);
28870 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28871 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
28872 LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
28873 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
28874 return (int64_t)ret_conv;
28877 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) {
28878 LDKChannelManager this_arg_conv;
28879 this_arg_conv.inner = (void*)(this_arg & (~1));
28880 this_arg_conv.is_owned = false;
28881 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28882 LDKThirtyTwoBytes payment_hash_ref;
28883 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
28884 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
28885 void* min_value_msat_ptr = (void*)(((uintptr_t)min_value_msat) & ~1);
28886 CHECK_ACCESS(min_value_msat_ptr);
28887 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28888 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)min_value_msat) & ~1));
28889 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
28890 *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
28891 return (int64_t)ret_conv;
28894 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) {
28895 LDKChannelManager this_arg_conv;
28896 this_arg_conv.inner = (void*)(this_arg & (~1));
28897 this_arg_conv.is_owned = false;
28898 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28899 LDKThirtyTwoBytes payment_hash_ref;
28900 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
28901 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
28902 LDKThirtyTwoBytes payment_secret_ref;
28903 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
28904 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
28905 LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
28906 *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
28907 return (int64_t)ret_conv;
28910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
28911 LDKChannelManager this_arg_conv;
28912 this_arg_conv.inner = (void*)(this_arg & (~1));
28913 this_arg_conv.is_owned = false;
28914 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28915 int64_t ret_val = ChannelManager_get_phantom_scid(&this_arg_conv);
28919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
28920 LDKChannelManager this_arg_conv;
28921 this_arg_conv.inner = (void*)(this_arg & (~1));
28922 this_arg_conv.is_owned = false;
28923 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28924 LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
28925 int64_t ret_ref = 0;
28926 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28927 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28928 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28929 ret_ref = (uintptr_t)ret_var.inner;
28930 if (ret_var.is_owned) {
28936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
28937 LDKChannelManager this_arg_conv;
28938 this_arg_conv.inner = (void*)(this_arg & (~1));
28939 this_arg_conv.is_owned = false;
28940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28941 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28942 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
28943 return (int64_t)ret_ret;
28946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
28947 LDKChannelManager this_arg_conv;
28948 this_arg_conv.inner = (void*)(this_arg & (~1));
28949 this_arg_conv.is_owned = false;
28950 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28951 LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
28952 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
28953 return (int64_t)ret_ret;
28956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
28957 LDKChannelManager this_arg_conv;
28958 this_arg_conv.inner = (void*)(this_arg & (~1));
28959 this_arg_conv.is_owned = false;
28960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28961 LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
28962 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
28963 return (int64_t)ret_ret;
28966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
28967 LDKChannelManager this_arg_conv;
28968 this_arg_conv.inner = (void*)(this_arg & (~1));
28969 this_arg_conv.is_owned = false;
28970 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28971 LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
28972 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
28973 return (int64_t)ret_ret;
28976 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) {
28977 LDKChannelManager this_arg_conv;
28978 this_arg_conv.inner = (void*)(this_arg & (~1));
28979 this_arg_conv.is_owned = false;
28980 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28981 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
28985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
28986 LDKChannelManager this_arg_conv;
28987 this_arg_conv.inner = (void*)(this_arg & (~1));
28988 this_arg_conv.is_owned = false;
28989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28990 ChannelManager_await_persistable_update(&this_arg_conv);
28993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
28994 LDKChannelManager this_arg_conv;
28995 this_arg_conv.inner = (void*)(this_arg & (~1));
28996 this_arg_conv.is_owned = false;
28997 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28998 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
28999 int64_t ret_ref = 0;
29000 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29001 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29002 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29003 ret_ref = (uintptr_t)ret_var.inner;
29004 if (ret_var.is_owned) {
29010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
29011 LDKChannelManager this_arg_conv;
29012 this_arg_conv.inner = (void*)(this_arg & (~1));
29013 this_arg_conv.is_owned = false;
29014 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29015 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29016 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29017 return (int64_t)ret_ret;
29020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
29021 LDKCounterpartyForwardingInfo obj_conv;
29022 obj_conv.inner = (void*)(obj & (~1));
29023 obj_conv.is_owned = false;
29024 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29025 LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29026 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29027 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29028 CVec_u8Z_free(ret_var);
29032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29033 LDKu8slice ser_ref;
29034 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29035 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29036 LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29037 *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29038 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29039 return (int64_t)ret_conv;
29042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
29043 LDKChannelCounterparty obj_conv;
29044 obj_conv.inner = (void*)(obj & (~1));
29045 obj_conv.is_owned = false;
29046 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29047 LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29048 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29049 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29050 CVec_u8Z_free(ret_var);
29054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29055 LDKu8slice ser_ref;
29056 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29057 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29058 LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29059 *ret_conv = ChannelCounterparty_read(ser_ref);
29060 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29061 return (int64_t)ret_conv;
29064 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
29065 LDKChannelDetails obj_conv;
29066 obj_conv.inner = (void*)(obj & (~1));
29067 obj_conv.is_owned = false;
29068 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29069 LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29070 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29071 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29072 CVec_u8Z_free(ret_var);
29076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29077 LDKu8slice ser_ref;
29078 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29079 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29080 LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29081 *ret_conv = ChannelDetails_read(ser_ref);
29082 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29083 return (int64_t)ret_conv;
29086 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
29087 LDKPhantomRouteHints obj_conv;
29088 obj_conv.inner = (void*)(obj & (~1));
29089 obj_conv.is_owned = false;
29090 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29091 LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29092 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29093 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29094 CVec_u8Z_free(ret_var);
29098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
29099 LDKu8slice ser_ref;
29100 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29101 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29102 LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29103 *ret_conv = PhantomRouteHints_read(ser_ref);
29104 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29105 return (int64_t)ret_conv;
29108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
29109 LDKChannelManager obj_conv;
29110 obj_conv.inner = (void*)(obj & (~1));
29111 obj_conv.is_owned = false;
29112 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29113 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29114 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
29115 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
29116 CVec_u8Z_free(ret_var);
29120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29121 LDKChannelManagerReadArgs this_obj_conv;
29122 this_obj_conv.inner = (void*)(this_obj & (~1));
29123 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29124 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29125 ChannelManagerReadArgs_free(this_obj_conv);
29128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
29129 LDKChannelManagerReadArgs this_ptr_conv;
29130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29131 this_ptr_conv.is_owned = false;
29132 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29133 // WARNING: This object doesn't live past this scope, needs clone!
29134 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
29138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29139 LDKChannelManagerReadArgs this_ptr_conv;
29140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29141 this_ptr_conv.is_owned = false;
29142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29143 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29144 CHECK_ACCESS(val_ptr);
29145 LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
29146 if (val_conv.free == LDKKeysInterface_JCalls_free) {
29147 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29148 LDKKeysInterface_JCalls_cloned(&val_conv);
29150 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
29153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
29154 LDKChannelManagerReadArgs this_ptr_conv;
29155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29156 this_ptr_conv.is_owned = false;
29157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29158 // WARNING: This object doesn't live past this scope, needs clone!
29159 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
29163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29164 LDKChannelManagerReadArgs this_ptr_conv;
29165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29166 this_ptr_conv.is_owned = false;
29167 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29168 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29169 CHECK_ACCESS(val_ptr);
29170 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29171 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29172 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29173 LDKFeeEstimator_JCalls_cloned(&val_conv);
29175 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
29179 LDKChannelManagerReadArgs this_ptr_conv;
29180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29181 this_ptr_conv.is_owned = false;
29182 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29183 // WARNING: This object doesn't live past this scope, needs clone!
29184 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
29188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29189 LDKChannelManagerReadArgs this_ptr_conv;
29190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29191 this_ptr_conv.is_owned = false;
29192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29193 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29194 CHECK_ACCESS(val_ptr);
29195 LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29196 if (val_conv.free == LDKWatch_JCalls_free) {
29197 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29198 LDKWatch_JCalls_cloned(&val_conv);
29200 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
29204 LDKChannelManagerReadArgs this_ptr_conv;
29205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29206 this_ptr_conv.is_owned = false;
29207 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29208 // WARNING: This object doesn't live past this scope, needs clone!
29209 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
29213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29214 LDKChannelManagerReadArgs this_ptr_conv;
29215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29216 this_ptr_conv.is_owned = false;
29217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29218 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29219 CHECK_ACCESS(val_ptr);
29220 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29221 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29222 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29223 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29225 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
29229 LDKChannelManagerReadArgs this_ptr_conv;
29230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29231 this_ptr_conv.is_owned = false;
29232 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29233 // WARNING: This object doesn't live past this scope, needs clone!
29234 int64_t ret_ret = ((uintptr_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
29238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29239 LDKChannelManagerReadArgs this_ptr_conv;
29240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29241 this_ptr_conv.is_owned = false;
29242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29243 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
29244 CHECK_ACCESS(val_ptr);
29245 LDKLogger val_conv = *(LDKLogger*)(val_ptr);
29246 if (val_conv.free == LDKLogger_JCalls_free) {
29247 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29248 LDKLogger_JCalls_cloned(&val_conv);
29250 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
29253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
29254 LDKChannelManagerReadArgs this_ptr_conv;
29255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29256 this_ptr_conv.is_owned = false;
29257 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29258 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
29259 int64_t ret_ref = 0;
29260 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29261 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29262 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29263 ret_ref = (uintptr_t)ret_var.inner;
29264 if (ret_var.is_owned) {
29270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29271 LDKChannelManagerReadArgs this_ptr_conv;
29272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29273 this_ptr_conv.is_owned = false;
29274 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29275 LDKUserConfig val_conv;
29276 val_conv.inner = (void*)(val & (~1));
29277 val_conv.is_owned = (val & 1) || (val == 0);
29278 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29279 val_conv = UserConfig_clone(&val_conv);
29280 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
29283 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) {
29284 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
29285 CHECK_ACCESS(keys_manager_ptr);
29286 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29287 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29288 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29289 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29291 void* fee_estimator_ptr = (void*)(((uintptr_t)fee_estimator) & ~1);
29292 CHECK_ACCESS(fee_estimator_ptr);
29293 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29294 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29295 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29296 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29298 void* chain_monitor_ptr = (void*)(((uintptr_t)chain_monitor) & ~1);
29299 CHECK_ACCESS(chain_monitor_ptr);
29300 LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29301 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29302 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29303 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29305 void* tx_broadcaster_ptr = (void*)(((uintptr_t)tx_broadcaster) & ~1);
29306 CHECK_ACCESS(tx_broadcaster_ptr);
29307 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29308 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29309 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29310 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29312 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
29313 CHECK_ACCESS(logger_ptr);
29314 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29315 if (logger_conv.free == LDKLogger_JCalls_free) {
29316 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29317 LDKLogger_JCalls_cloned(&logger_conv);
29319 LDKUserConfig default_config_conv;
29320 default_config_conv.inner = (void*)(default_config & (~1));
29321 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
29322 CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
29323 default_config_conv = UserConfig_clone(&default_config_conv);
29324 LDKCVec_ChannelMonitorZ channel_monitors_constr;
29325 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
29326 if (channel_monitors_constr.datalen > 0)
29327 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
29329 channel_monitors_constr.data = NULL;
29330 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
29331 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
29332 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
29333 LDKChannelMonitor channel_monitors_conv_16_conv;
29334 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
29335 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
29336 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
29337 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
29339 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
29340 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);
29341 int64_t ret_ref = 0;
29342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29345 ret_ref = (uintptr_t)ret_var.inner;
29346 if (ret_var.is_owned) {
29352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
29353 LDKu8slice ser_ref;
29354 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
29355 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
29356 LDKChannelManagerReadArgs arg_conv;
29357 arg_conv.inner = (void*)(arg & (~1));
29358 arg_conv.is_owned = (arg & 1) || (arg == 0);
29359 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29360 // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
29361 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
29362 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
29363 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
29364 return (int64_t)ret_conv;
29367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29368 LDKDecodeError this_obj_conv;
29369 this_obj_conv.inner = (void*)(this_obj & (~1));
29370 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29372 DecodeError_free(this_obj_conv);
29375 static inline uintptr_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
29376 LDKDecodeError ret_var = DecodeError_clone(arg);
29377 int64_t ret_ref = 0;
29378 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29379 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29380 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29381 ret_ref = (uintptr_t)ret_var.inner;
29382 if (ret_var.is_owned) {
29387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29388 LDKDecodeError arg_conv;
29389 arg_conv.inner = (void*)(arg & (~1));
29390 arg_conv.is_owned = false;
29391 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29392 int64_t ret_val = DecodeError_clone_ptr(&arg_conv);
29396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29397 LDKDecodeError orig_conv;
29398 orig_conv.inner = (void*)(orig & (~1));
29399 orig_conv.is_owned = false;
29400 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29401 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
29402 int64_t ret_ref = 0;
29403 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29404 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29405 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29406 ret_ref = (uintptr_t)ret_var.inner;
29407 if (ret_var.is_owned) {
29413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29414 LDKInit this_obj_conv;
29415 this_obj_conv.inner = (void*)(this_obj & (~1));
29416 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29417 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29418 Init_free(this_obj_conv);
29421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
29422 LDKInit this_ptr_conv;
29423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29424 this_ptr_conv.is_owned = false;
29425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29426 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
29427 int64_t ret_ref = 0;
29428 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29429 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29431 ret_ref = (uintptr_t)ret_var.inner;
29432 if (ret_var.is_owned) {
29438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29439 LDKInit this_ptr_conv;
29440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29441 this_ptr_conv.is_owned = false;
29442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29443 LDKInitFeatures val_conv;
29444 val_conv.inner = (void*)(val & (~1));
29445 val_conv.is_owned = (val & 1) || (val == 0);
29446 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29447 val_conv = InitFeatures_clone(&val_conv);
29448 Init_set_features(&this_ptr_conv, val_conv);
29451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
29452 LDKInitFeatures features_arg_conv;
29453 features_arg_conv.inner = (void*)(features_arg & (~1));
29454 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
29455 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
29456 features_arg_conv = InitFeatures_clone(&features_arg_conv);
29457 LDKInit ret_var = Init_new(features_arg_conv);
29458 int64_t ret_ref = 0;
29459 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29460 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29461 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29462 ret_ref = (uintptr_t)ret_var.inner;
29463 if (ret_var.is_owned) {
29469 static inline uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
29470 LDKInit ret_var = Init_clone(arg);
29471 int64_t ret_ref = 0;
29472 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29473 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29474 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29475 ret_ref = (uintptr_t)ret_var.inner;
29476 if (ret_var.is_owned) {
29481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29483 arg_conv.inner = (void*)(arg & (~1));
29484 arg_conv.is_owned = false;
29485 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29486 int64_t ret_val = Init_clone_ptr(&arg_conv);
29490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29492 orig_conv.inner = (void*)(orig & (~1));
29493 orig_conv.is_owned = false;
29494 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29495 LDKInit ret_var = Init_clone(&orig_conv);
29496 int64_t ret_ref = 0;
29497 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29498 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29499 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29500 ret_ref = (uintptr_t)ret_var.inner;
29501 if (ret_var.is_owned) {
29507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29508 LDKErrorMessage this_obj_conv;
29509 this_obj_conv.inner = (void*)(this_obj & (~1));
29510 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29512 ErrorMessage_free(this_obj_conv);
29515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29516 LDKErrorMessage this_ptr_conv;
29517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29518 this_ptr_conv.is_owned = false;
29519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29520 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29521 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
29525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29526 LDKErrorMessage this_ptr_conv;
29527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29528 this_ptr_conv.is_owned = false;
29529 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29530 LDKThirtyTwoBytes val_ref;
29531 CHECK((*env)->GetArrayLength(env, val) == 32);
29532 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29533 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
29536 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
29537 LDKErrorMessage this_ptr_conv;
29538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29539 this_ptr_conv.is_owned = false;
29540 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29541 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
29542 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
29548 LDKErrorMessage this_ptr_conv;
29549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29550 this_ptr_conv.is_owned = false;
29551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29552 LDKStr val_conv = java_to_owned_str(env, val);
29553 ErrorMessage_set_data(&this_ptr_conv, val_conv);
29556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
29557 LDKThirtyTwoBytes channel_id_arg_ref;
29558 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29559 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29560 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
29561 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
29562 int64_t ret_ref = 0;
29563 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29564 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29565 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29566 ret_ref = (uintptr_t)ret_var.inner;
29567 if (ret_var.is_owned) {
29573 static inline uintptr_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
29574 LDKErrorMessage ret_var = ErrorMessage_clone(arg);
29575 int64_t ret_ref = 0;
29576 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29577 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29579 ret_ref = (uintptr_t)ret_var.inner;
29580 if (ret_var.is_owned) {
29585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29586 LDKErrorMessage arg_conv;
29587 arg_conv.inner = (void*)(arg & (~1));
29588 arg_conv.is_owned = false;
29589 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29590 int64_t ret_val = ErrorMessage_clone_ptr(&arg_conv);
29594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29595 LDKErrorMessage orig_conv;
29596 orig_conv.inner = (void*)(orig & (~1));
29597 orig_conv.is_owned = false;
29598 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29599 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
29600 int64_t ret_ref = 0;
29601 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29602 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29603 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29604 ret_ref = (uintptr_t)ret_var.inner;
29605 if (ret_var.is_owned) {
29611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29612 LDKWarningMessage this_obj_conv;
29613 this_obj_conv.inner = (void*)(this_obj & (~1));
29614 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29616 WarningMessage_free(this_obj_conv);
29619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29620 LDKWarningMessage this_ptr_conv;
29621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29622 this_ptr_conv.is_owned = false;
29623 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29624 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29625 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *WarningMessage_get_channel_id(&this_ptr_conv));
29629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29630 LDKWarningMessage this_ptr_conv;
29631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29632 this_ptr_conv.is_owned = false;
29633 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29634 LDKThirtyTwoBytes val_ref;
29635 CHECK((*env)->GetArrayLength(env, val) == 32);
29636 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29637 WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
29640 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
29641 LDKWarningMessage this_ptr_conv;
29642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29643 this_ptr_conv.is_owned = false;
29644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29645 LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
29646 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
29652 LDKWarningMessage this_ptr_conv;
29653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29654 this_ptr_conv.is_owned = false;
29655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29656 LDKStr val_conv = java_to_owned_str(env, val);
29657 WarningMessage_set_data(&this_ptr_conv, val_conv);
29660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
29661 LDKThirtyTwoBytes channel_id_arg_ref;
29662 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
29663 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
29664 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
29665 LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
29666 int64_t ret_ref = 0;
29667 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29668 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29669 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29670 ret_ref = (uintptr_t)ret_var.inner;
29671 if (ret_var.is_owned) {
29677 static inline uintptr_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
29678 LDKWarningMessage ret_var = WarningMessage_clone(arg);
29679 int64_t ret_ref = 0;
29680 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29681 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29682 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29683 ret_ref = (uintptr_t)ret_var.inner;
29684 if (ret_var.is_owned) {
29689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29690 LDKWarningMessage arg_conv;
29691 arg_conv.inner = (void*)(arg & (~1));
29692 arg_conv.is_owned = false;
29693 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29694 int64_t ret_val = WarningMessage_clone_ptr(&arg_conv);
29698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29699 LDKWarningMessage orig_conv;
29700 orig_conv.inner = (void*)(orig & (~1));
29701 orig_conv.is_owned = false;
29702 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29703 LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
29704 int64_t ret_ref = 0;
29705 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29706 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29707 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29708 ret_ref = (uintptr_t)ret_var.inner;
29709 if (ret_var.is_owned) {
29715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29716 LDKPing this_obj_conv;
29717 this_obj_conv.inner = (void*)(this_obj & (~1));
29718 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29719 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29720 Ping_free(this_obj_conv);
29723 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
29724 LDKPing 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 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
29732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29733 LDKPing this_ptr_conv;
29734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29735 this_ptr_conv.is_owned = false;
29736 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29737 Ping_set_ponglen(&this_ptr_conv, val);
29740 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
29741 LDKPing this_ptr_conv;
29742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29743 this_ptr_conv.is_owned = false;
29744 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29745 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
29749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29750 LDKPing this_ptr_conv;
29751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29752 this_ptr_conv.is_owned = false;
29753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29754 Ping_set_byteslen(&this_ptr_conv, val);
29757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
29758 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
29759 int64_t ret_ref = 0;
29760 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29761 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29762 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29763 ret_ref = (uintptr_t)ret_var.inner;
29764 if (ret_var.is_owned) {
29770 static inline uintptr_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
29771 LDKPing ret_var = Ping_clone(arg);
29772 int64_t ret_ref = 0;
29773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29776 ret_ref = (uintptr_t)ret_var.inner;
29777 if (ret_var.is_owned) {
29782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29784 arg_conv.inner = (void*)(arg & (~1));
29785 arg_conv.is_owned = false;
29786 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29787 int64_t ret_val = Ping_clone_ptr(&arg_conv);
29791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29793 orig_conv.inner = (void*)(orig & (~1));
29794 orig_conv.is_owned = false;
29795 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29796 LDKPing ret_var = Ping_clone(&orig_conv);
29797 int64_t ret_ref = 0;
29798 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29799 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29800 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29801 ret_ref = (uintptr_t)ret_var.inner;
29802 if (ret_var.is_owned) {
29808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29809 LDKPong this_obj_conv;
29810 this_obj_conv.inner = (void*)(this_obj & (~1));
29811 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29812 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29813 Pong_free(this_obj_conv);
29816 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
29817 LDKPong this_ptr_conv;
29818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29819 this_ptr_conv.is_owned = false;
29820 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29821 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
29825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
29826 LDKPong this_ptr_conv;
29827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29828 this_ptr_conv.is_owned = false;
29829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29830 Pong_set_byteslen(&this_ptr_conv, val);
29833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
29834 LDKPong ret_var = Pong_new(byteslen_arg);
29835 int64_t ret_ref = 0;
29836 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29837 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29838 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29839 ret_ref = (uintptr_t)ret_var.inner;
29840 if (ret_var.is_owned) {
29846 static inline uintptr_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
29847 LDKPong ret_var = Pong_clone(arg);
29848 int64_t ret_ref = 0;
29849 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29850 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29851 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29852 ret_ref = (uintptr_t)ret_var.inner;
29853 if (ret_var.is_owned) {
29858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29860 arg_conv.inner = (void*)(arg & (~1));
29861 arg_conv.is_owned = false;
29862 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29863 int64_t ret_val = Pong_clone_ptr(&arg_conv);
29867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29869 orig_conv.inner = (void*)(orig & (~1));
29870 orig_conv.is_owned = false;
29871 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29872 LDKPong ret_var = Pong_clone(&orig_conv);
29873 int64_t ret_ref = 0;
29874 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29875 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29876 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29877 ret_ref = (uintptr_t)ret_var.inner;
29878 if (ret_var.is_owned) {
29884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
29885 LDKOpenChannel this_obj_conv;
29886 this_obj_conv.inner = (void*)(this_obj & (~1));
29887 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
29888 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29889 OpenChannel_free(this_obj_conv);
29892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
29893 LDKOpenChannel this_ptr_conv;
29894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29895 this_ptr_conv.is_owned = false;
29896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29897 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29898 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
29902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29903 LDKOpenChannel this_ptr_conv;
29904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29905 this_ptr_conv.is_owned = false;
29906 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29907 LDKThirtyTwoBytes val_ref;
29908 CHECK((*env)->GetArrayLength(env, val) == 32);
29909 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29910 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
29913 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
29914 LDKOpenChannel this_ptr_conv;
29915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29916 this_ptr_conv.is_owned = false;
29917 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29918 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29919 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
29923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
29924 LDKOpenChannel this_ptr_conv;
29925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29926 this_ptr_conv.is_owned = false;
29927 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29928 LDKThirtyTwoBytes val_ref;
29929 CHECK((*env)->GetArrayLength(env, val) == 32);
29930 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
29931 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
29934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29935 LDKOpenChannel this_ptr_conv;
29936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29937 this_ptr_conv.is_owned = false;
29938 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29939 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
29943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29944 LDKOpenChannel this_ptr_conv;
29945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29946 this_ptr_conv.is_owned = false;
29947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29948 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
29951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
29952 LDKOpenChannel this_ptr_conv;
29953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29954 this_ptr_conv.is_owned = false;
29955 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29956 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
29960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29961 LDKOpenChannel this_ptr_conv;
29962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29963 this_ptr_conv.is_owned = false;
29964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29965 OpenChannel_set_push_msat(&this_ptr_conv, val);
29968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
29969 LDKOpenChannel this_ptr_conv;
29970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29971 this_ptr_conv.is_owned = false;
29972 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29973 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
29977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
29978 LDKOpenChannel this_ptr_conv;
29979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29980 this_ptr_conv.is_owned = false;
29981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29982 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
29985 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) {
29986 LDKOpenChannel this_ptr_conv;
29987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29988 this_ptr_conv.is_owned = false;
29989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29990 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
29994 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) {
29995 LDKOpenChannel this_ptr_conv;
29996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
29997 this_ptr_conv.is_owned = false;
29998 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29999 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30003 LDKOpenChannel this_ptr_conv;
30004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30005 this_ptr_conv.is_owned = false;
30006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30007 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30012 LDKOpenChannel this_ptr_conv;
30013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30014 this_ptr_conv.is_owned = false;
30015 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30016 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30020 LDKOpenChannel this_ptr_conv;
30021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30022 this_ptr_conv.is_owned = false;
30023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30024 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30029 LDKOpenChannel this_ptr_conv;
30030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30031 this_ptr_conv.is_owned = false;
30032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30033 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30036 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
30037 LDKOpenChannel this_ptr_conv;
30038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30039 this_ptr_conv.is_owned = false;
30040 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30041 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
30045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30046 LDKOpenChannel this_ptr_conv;
30047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30048 this_ptr_conv.is_owned = false;
30049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30050 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
30053 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30054 LDKOpenChannel this_ptr_conv;
30055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30056 this_ptr_conv.is_owned = false;
30057 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30058 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
30062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30063 LDKOpenChannel this_ptr_conv;
30064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30065 this_ptr_conv.is_owned = false;
30066 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30067 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
30070 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
30071 LDKOpenChannel this_ptr_conv;
30072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30073 this_ptr_conv.is_owned = false;
30074 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30075 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
30079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30080 LDKOpenChannel this_ptr_conv;
30081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30082 this_ptr_conv.is_owned = false;
30083 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30084 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30087 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30088 LDKOpenChannel this_ptr_conv;
30089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30090 this_ptr_conv.is_owned = false;
30091 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30092 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30093 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
30097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30098 LDKOpenChannel this_ptr_conv;
30099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30100 this_ptr_conv.is_owned = false;
30101 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30102 LDKPublicKey val_ref;
30103 CHECK((*env)->GetArrayLength(env, val) == 33);
30104 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30105 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30109 LDKOpenChannel this_ptr_conv;
30110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30111 this_ptr_conv.is_owned = false;
30112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30113 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30114 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
30118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30119 LDKOpenChannel this_ptr_conv;
30120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30121 this_ptr_conv.is_owned = false;
30122 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30123 LDKPublicKey val_ref;
30124 CHECK((*env)->GetArrayLength(env, val) == 33);
30125 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30126 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30129 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30130 LDKOpenChannel this_ptr_conv;
30131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30132 this_ptr_conv.is_owned = false;
30133 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30134 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30135 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
30139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30140 LDKOpenChannel this_ptr_conv;
30141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30142 this_ptr_conv.is_owned = false;
30143 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30144 LDKPublicKey val_ref;
30145 CHECK((*env)->GetArrayLength(env, val) == 33);
30146 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30147 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
30150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30151 LDKOpenChannel this_ptr_conv;
30152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30153 this_ptr_conv.is_owned = false;
30154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30155 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30156 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
30160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30161 LDKOpenChannel this_ptr_conv;
30162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30163 this_ptr_conv.is_owned = false;
30164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30165 LDKPublicKey val_ref;
30166 CHECK((*env)->GetArrayLength(env, val) == 33);
30167 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30168 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
30171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30172 LDKOpenChannel this_ptr_conv;
30173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30174 this_ptr_conv.is_owned = false;
30175 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30176 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30177 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
30181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30182 LDKOpenChannel this_ptr_conv;
30183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30184 this_ptr_conv.is_owned = false;
30185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30186 LDKPublicKey val_ref;
30187 CHECK((*env)->GetArrayLength(env, val) == 33);
30188 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30189 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
30192 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30193 LDKOpenChannel this_ptr_conv;
30194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30195 this_ptr_conv.is_owned = false;
30196 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30197 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30198 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
30202 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) {
30203 LDKOpenChannel this_ptr_conv;
30204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30205 this_ptr_conv.is_owned = false;
30206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30207 LDKPublicKey val_ref;
30208 CHECK((*env)->GetArrayLength(env, val) == 33);
30209 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30210 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
30213 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
30214 LDKOpenChannel this_ptr_conv;
30215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30216 this_ptr_conv.is_owned = false;
30217 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30218 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
30222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
30223 LDKOpenChannel this_ptr_conv;
30224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30225 this_ptr_conv.is_owned = false;
30226 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30227 OpenChannel_set_channel_flags(&this_ptr_conv, val);
30230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
30231 LDKOpenChannel this_ptr_conv;
30232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30233 this_ptr_conv.is_owned = false;
30234 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30235 LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
30236 int64_t ret_ref = 0;
30237 if ((uintptr_t)ret_var.inner > 4096) {
30238 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30239 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30240 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30241 ret_ref = (uintptr_t)ret_var.inner;
30242 if (ret_var.is_owned) {
30249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30250 LDKOpenChannel this_ptr_conv;
30251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30252 this_ptr_conv.is_owned = false;
30253 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30254 LDKChannelTypeFeatures val_conv;
30255 val_conv.inner = (void*)(val & (~1));
30256 val_conv.is_owned = (val & 1) || (val == 0);
30257 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30258 val_conv = ChannelTypeFeatures_clone(&val_conv);
30259 OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
30262 static inline uintptr_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
30263 LDKOpenChannel ret_var = OpenChannel_clone(arg);
30264 int64_t ret_ref = 0;
30265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30268 ret_ref = (uintptr_t)ret_var.inner;
30269 if (ret_var.is_owned) {
30274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30275 LDKOpenChannel arg_conv;
30276 arg_conv.inner = (void*)(arg & (~1));
30277 arg_conv.is_owned = false;
30278 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30279 int64_t ret_val = OpenChannel_clone_ptr(&arg_conv);
30283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30284 LDKOpenChannel orig_conv;
30285 orig_conv.inner = (void*)(orig & (~1));
30286 orig_conv.is_owned = false;
30287 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30288 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
30289 int64_t ret_ref = 0;
30290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30293 ret_ref = (uintptr_t)ret_var.inner;
30294 if (ret_var.is_owned) {
30300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30301 LDKAcceptChannel this_obj_conv;
30302 this_obj_conv.inner = (void*)(this_obj & (~1));
30303 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30305 AcceptChannel_free(this_obj_conv);
30308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30309 LDKAcceptChannel this_ptr_conv;
30310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30311 this_ptr_conv.is_owned = false;
30312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30313 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30314 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
30318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30319 LDKAcceptChannel this_ptr_conv;
30320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30321 this_ptr_conv.is_owned = false;
30322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30323 LDKThirtyTwoBytes val_ref;
30324 CHECK((*env)->GetArrayLength(env, val) == 32);
30325 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30326 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30330 LDKAcceptChannel this_ptr_conv;
30331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30332 this_ptr_conv.is_owned = false;
30333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30334 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
30338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30339 LDKAcceptChannel this_ptr_conv;
30340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30341 this_ptr_conv.is_owned = false;
30342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30343 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30346 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) {
30347 LDKAcceptChannel this_ptr_conv;
30348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30349 this_ptr_conv.is_owned = false;
30350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30351 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30355 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) {
30356 LDKAcceptChannel this_ptr_conv;
30357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30358 this_ptr_conv.is_owned = false;
30359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30360 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
30364 LDKAcceptChannel this_ptr_conv;
30365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30366 this_ptr_conv.is_owned = false;
30367 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30368 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30373 LDKAcceptChannel this_ptr_conv;
30374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30375 this_ptr_conv.is_owned = false;
30376 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30377 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
30381 LDKAcceptChannel this_ptr_conv;
30382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30383 this_ptr_conv.is_owned = false;
30384 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30385 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
30389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30390 LDKAcceptChannel this_ptr_conv;
30391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30392 this_ptr_conv.is_owned = false;
30393 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30394 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30397 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
30398 LDKAcceptChannel this_ptr_conv;
30399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30400 this_ptr_conv.is_owned = false;
30401 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30402 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
30406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
30407 LDKAcceptChannel this_ptr_conv;
30408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30409 this_ptr_conv.is_owned = false;
30410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30411 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
30414 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
30415 LDKAcceptChannel this_ptr_conv;
30416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30417 this_ptr_conv.is_owned = false;
30418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30419 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
30423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30424 LDKAcceptChannel this_ptr_conv;
30425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30426 this_ptr_conv.is_owned = false;
30427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30428 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
30431 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
30432 LDKAcceptChannel this_ptr_conv;
30433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30434 this_ptr_conv.is_owned = false;
30435 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30436 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
30440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30441 LDKAcceptChannel this_ptr_conv;
30442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30443 this_ptr_conv.is_owned = false;
30444 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30445 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
30449 LDKAcceptChannel this_ptr_conv;
30450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30451 this_ptr_conv.is_owned = false;
30452 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30453 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30454 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
30458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30459 LDKAcceptChannel this_ptr_conv;
30460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30461 this_ptr_conv.is_owned = false;
30462 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30463 LDKPublicKey val_ref;
30464 CHECK((*env)->GetArrayLength(env, val) == 33);
30465 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30466 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30469 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30470 LDKAcceptChannel this_ptr_conv;
30471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30472 this_ptr_conv.is_owned = false;
30473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30474 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30475 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
30479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30480 LDKAcceptChannel 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 LDKPublicKey val_ref;
30485 CHECK((*env)->GetArrayLength(env, val) == 33);
30486 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30487 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30491 LDKAcceptChannel this_ptr_conv;
30492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30493 this_ptr_conv.is_owned = false;
30494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30495 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30496 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
30500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30501 LDKAcceptChannel this_ptr_conv;
30502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30503 this_ptr_conv.is_owned = false;
30504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30505 LDKPublicKey val_ref;
30506 CHECK((*env)->GetArrayLength(env, val) == 33);
30507 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30508 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
30511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30512 LDKAcceptChannel this_ptr_conv;
30513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30514 this_ptr_conv.is_owned = false;
30515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30516 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30517 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
30521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30522 LDKAcceptChannel 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 LDKPublicKey val_ref;
30527 CHECK((*env)->GetArrayLength(env, val) == 33);
30528 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30529 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
30532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
30533 LDKAcceptChannel this_ptr_conv;
30534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30535 this_ptr_conv.is_owned = false;
30536 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30537 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30538 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
30542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30543 LDKAcceptChannel this_ptr_conv;
30544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30545 this_ptr_conv.is_owned = false;
30546 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30547 LDKPublicKey val_ref;
30548 CHECK((*env)->GetArrayLength(env, val) == 33);
30549 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30550 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
30553 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30554 LDKAcceptChannel this_ptr_conv;
30555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30556 this_ptr_conv.is_owned = false;
30557 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30558 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30559 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
30563 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) {
30564 LDKAcceptChannel this_ptr_conv;
30565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30566 this_ptr_conv.is_owned = false;
30567 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30568 LDKPublicKey val_ref;
30569 CHECK((*env)->GetArrayLength(env, val) == 33);
30570 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30571 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
30574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
30575 LDKAcceptChannel this_ptr_conv;
30576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30577 this_ptr_conv.is_owned = false;
30578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30579 LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
30580 int64_t ret_ref = 0;
30581 if ((uintptr_t)ret_var.inner > 4096) {
30582 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30583 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30584 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30585 ret_ref = (uintptr_t)ret_var.inner;
30586 if (ret_var.is_owned) {
30593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
30594 LDKAcceptChannel this_ptr_conv;
30595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30596 this_ptr_conv.is_owned = false;
30597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30598 LDKChannelTypeFeatures val_conv;
30599 val_conv.inner = (void*)(val & (~1));
30600 val_conv.is_owned = (val & 1) || (val == 0);
30601 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30602 val_conv = ChannelTypeFeatures_clone(&val_conv);
30603 AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
30606 static inline uintptr_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
30607 LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
30608 int64_t ret_ref = 0;
30609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30612 ret_ref = (uintptr_t)ret_var.inner;
30613 if (ret_var.is_owned) {
30618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30619 LDKAcceptChannel arg_conv;
30620 arg_conv.inner = (void*)(arg & (~1));
30621 arg_conv.is_owned = false;
30622 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30623 int64_t ret_val = AcceptChannel_clone_ptr(&arg_conv);
30627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30628 LDKAcceptChannel orig_conv;
30629 orig_conv.inner = (void*)(orig & (~1));
30630 orig_conv.is_owned = false;
30631 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30632 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
30633 int64_t ret_ref = 0;
30634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30637 ret_ref = (uintptr_t)ret_var.inner;
30638 if (ret_var.is_owned) {
30644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30645 LDKFundingCreated this_obj_conv;
30646 this_obj_conv.inner = (void*)(this_obj & (~1));
30647 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30648 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30649 FundingCreated_free(this_obj_conv);
30652 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30653 LDKFundingCreated this_ptr_conv;
30654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30655 this_ptr_conv.is_owned = false;
30656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30657 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30658 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
30662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30663 LDKFundingCreated this_ptr_conv;
30664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30665 this_ptr_conv.is_owned = false;
30666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30667 LDKThirtyTwoBytes val_ref;
30668 CHECK((*env)->GetArrayLength(env, val) == 32);
30669 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30670 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
30673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
30674 LDKFundingCreated this_ptr_conv;
30675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30676 this_ptr_conv.is_owned = false;
30677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30678 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30679 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
30683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30684 LDKFundingCreated this_ptr_conv;
30685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30686 this_ptr_conv.is_owned = false;
30687 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30688 LDKThirtyTwoBytes val_ref;
30689 CHECK((*env)->GetArrayLength(env, val) == 32);
30690 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30691 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
30694 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
30695 LDKFundingCreated this_ptr_conv;
30696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30697 this_ptr_conv.is_owned = false;
30698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30699 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
30703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
30704 LDKFundingCreated this_ptr_conv;
30705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30706 this_ptr_conv.is_owned = false;
30707 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30708 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
30711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
30712 LDKFundingCreated this_ptr_conv;
30713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30714 this_ptr_conv.is_owned = false;
30715 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30716 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
30717 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
30721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30722 LDKFundingCreated this_ptr_conv;
30723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30724 this_ptr_conv.is_owned = false;
30725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30726 LDKSignature val_ref;
30727 CHECK((*env)->GetArrayLength(env, val) == 64);
30728 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
30729 FundingCreated_set_signature(&this_ptr_conv, val_ref);
30732 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) {
30733 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
30734 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
30735 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
30736 LDKThirtyTwoBytes funding_txid_arg_ref;
30737 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
30738 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
30739 LDKSignature signature_arg_ref;
30740 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
30741 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
30742 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
30743 int64_t ret_ref = 0;
30744 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30745 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30746 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30747 ret_ref = (uintptr_t)ret_var.inner;
30748 if (ret_var.is_owned) {
30754 static inline uintptr_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
30755 LDKFundingCreated ret_var = FundingCreated_clone(arg);
30756 int64_t ret_ref = 0;
30757 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30758 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30759 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30760 ret_ref = (uintptr_t)ret_var.inner;
30761 if (ret_var.is_owned) {
30766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30767 LDKFundingCreated arg_conv;
30768 arg_conv.inner = (void*)(arg & (~1));
30769 arg_conv.is_owned = false;
30770 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30771 int64_t ret_val = FundingCreated_clone_ptr(&arg_conv);
30775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30776 LDKFundingCreated orig_conv;
30777 orig_conv.inner = (void*)(orig & (~1));
30778 orig_conv.is_owned = false;
30779 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30780 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
30781 int64_t ret_ref = 0;
30782 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30783 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30784 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30785 ret_ref = (uintptr_t)ret_var.inner;
30786 if (ret_var.is_owned) {
30792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30793 LDKFundingSigned this_obj_conv;
30794 this_obj_conv.inner = (void*)(this_obj & (~1));
30795 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30796 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30797 FundingSigned_free(this_obj_conv);
30800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30801 LDKFundingSigned this_ptr_conv;
30802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30803 this_ptr_conv.is_owned = false;
30804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30805 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30806 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
30810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30811 LDKFundingSigned this_ptr_conv;
30812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30813 this_ptr_conv.is_owned = false;
30814 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30815 LDKThirtyTwoBytes val_ref;
30816 CHECK((*env)->GetArrayLength(env, val) == 32);
30817 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30818 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
30821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
30822 LDKFundingSigned this_ptr_conv;
30823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30824 this_ptr_conv.is_owned = false;
30825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30826 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
30827 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
30831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30832 LDKFundingSigned this_ptr_conv;
30833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30834 this_ptr_conv.is_owned = false;
30835 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30836 LDKSignature val_ref;
30837 CHECK((*env)->GetArrayLength(env, val) == 64);
30838 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
30839 FundingSigned_set_signature(&this_ptr_conv, val_ref);
30842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
30843 LDKThirtyTwoBytes channel_id_arg_ref;
30844 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30845 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30846 LDKSignature signature_arg_ref;
30847 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
30848 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
30849 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
30850 int64_t ret_ref = 0;
30851 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30852 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30853 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30854 ret_ref = (uintptr_t)ret_var.inner;
30855 if (ret_var.is_owned) {
30861 static inline uintptr_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
30862 LDKFundingSigned ret_var = FundingSigned_clone(arg);
30863 int64_t ret_ref = 0;
30864 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30865 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30866 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30867 ret_ref = (uintptr_t)ret_var.inner;
30868 if (ret_var.is_owned) {
30873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30874 LDKFundingSigned arg_conv;
30875 arg_conv.inner = (void*)(arg & (~1));
30876 arg_conv.is_owned = false;
30877 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30878 int64_t ret_val = FundingSigned_clone_ptr(&arg_conv);
30882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30883 LDKFundingSigned orig_conv;
30884 orig_conv.inner = (void*)(orig & (~1));
30885 orig_conv.is_owned = false;
30886 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30887 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
30888 int64_t ret_ref = 0;
30889 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30890 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30891 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30892 ret_ref = (uintptr_t)ret_var.inner;
30893 if (ret_var.is_owned) {
30899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
30900 LDKFundingLocked this_obj_conv;
30901 this_obj_conv.inner = (void*)(this_obj & (~1));
30902 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
30903 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30904 FundingLocked_free(this_obj_conv);
30907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
30908 LDKFundingLocked this_ptr_conv;
30909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30910 this_ptr_conv.is_owned = false;
30911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30912 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
30913 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
30917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
30918 LDKFundingLocked this_ptr_conv;
30919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30920 this_ptr_conv.is_owned = false;
30921 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30922 LDKThirtyTwoBytes val_ref;
30923 CHECK((*env)->GetArrayLength(env, val) == 32);
30924 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
30925 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
30928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
30929 LDKFundingLocked this_ptr_conv;
30930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30931 this_ptr_conv.is_owned = false;
30932 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30933 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
30934 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
30938 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) {
30939 LDKFundingLocked this_ptr_conv;
30940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
30941 this_ptr_conv.is_owned = false;
30942 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30943 LDKPublicKey val_ref;
30944 CHECK((*env)->GetArrayLength(env, val) == 33);
30945 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
30946 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
30949 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) {
30950 LDKThirtyTwoBytes channel_id_arg_ref;
30951 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
30952 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
30953 LDKPublicKey next_per_commitment_point_arg_ref;
30954 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
30955 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
30956 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
30957 int64_t ret_ref = 0;
30958 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30959 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30960 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30961 ret_ref = (uintptr_t)ret_var.inner;
30962 if (ret_var.is_owned) {
30968 static inline uintptr_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg) {
30969 LDKFundingLocked ret_var = FundingLocked_clone(arg);
30970 int64_t ret_ref = 0;
30971 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30972 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30973 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30974 ret_ref = (uintptr_t)ret_var.inner;
30975 if (ret_var.is_owned) {
30980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30981 LDKFundingLocked arg_conv;
30982 arg_conv.inner = (void*)(arg & (~1));
30983 arg_conv.is_owned = false;
30984 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30985 int64_t ret_val = FundingLocked_clone_ptr(&arg_conv);
30989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30990 LDKFundingLocked orig_conv;
30991 orig_conv.inner = (void*)(orig & (~1));
30992 orig_conv.is_owned = false;
30993 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30994 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
30995 int64_t ret_ref = 0;
30996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
30997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
30998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30999 ret_ref = (uintptr_t)ret_var.inner;
31000 if (ret_var.is_owned) {
31006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31007 LDKShutdown this_obj_conv;
31008 this_obj_conv.inner = (void*)(this_obj & (~1));
31009 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31011 Shutdown_free(this_obj_conv);
31014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31015 LDKShutdown this_ptr_conv;
31016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31017 this_ptr_conv.is_owned = false;
31018 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31019 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31020 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
31024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31025 LDKShutdown this_ptr_conv;
31026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31027 this_ptr_conv.is_owned = false;
31028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31029 LDKThirtyTwoBytes val_ref;
31030 CHECK((*env)->GetArrayLength(env, val) == 32);
31031 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31032 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
31035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
31036 LDKShutdown this_ptr_conv;
31037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31038 this_ptr_conv.is_owned = false;
31039 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31040 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
31041 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
31042 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
31046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31047 LDKShutdown this_ptr_conv;
31048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31049 this_ptr_conv.is_owned = false;
31050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31051 LDKCVec_u8Z val_ref;
31052 val_ref.datalen = (*env)->GetArrayLength(env, val);
31053 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31054 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
31055 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
31058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
31059 LDKThirtyTwoBytes channel_id_arg_ref;
31060 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31061 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31062 LDKCVec_u8Z scriptpubkey_arg_ref;
31063 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
31064 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31065 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
31066 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
31067 int64_t ret_ref = 0;
31068 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31069 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31070 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31071 ret_ref = (uintptr_t)ret_var.inner;
31072 if (ret_var.is_owned) {
31078 static inline uintptr_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
31079 LDKShutdown ret_var = Shutdown_clone(arg);
31080 int64_t ret_ref = 0;
31081 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31082 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31083 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31084 ret_ref = (uintptr_t)ret_var.inner;
31085 if (ret_var.is_owned) {
31090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31091 LDKShutdown arg_conv;
31092 arg_conv.inner = (void*)(arg & (~1));
31093 arg_conv.is_owned = false;
31094 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31095 int64_t ret_val = Shutdown_clone_ptr(&arg_conv);
31099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31100 LDKShutdown orig_conv;
31101 orig_conv.inner = (void*)(orig & (~1));
31102 orig_conv.is_owned = false;
31103 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31104 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
31105 int64_t ret_ref = 0;
31106 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31107 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31108 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31109 ret_ref = (uintptr_t)ret_var.inner;
31110 if (ret_var.is_owned) {
31116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31117 LDKClosingSignedFeeRange this_obj_conv;
31118 this_obj_conv.inner = (void*)(this_obj & (~1));
31119 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31120 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31121 ClosingSignedFeeRange_free(this_obj_conv);
31124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31125 LDKClosingSignedFeeRange this_ptr_conv;
31126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31127 this_ptr_conv.is_owned = false;
31128 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31129 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
31133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31134 LDKClosingSignedFeeRange this_ptr_conv;
31135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31136 this_ptr_conv.is_owned = false;
31137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31138 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
31141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31142 LDKClosingSignedFeeRange this_ptr_conv;
31143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31144 this_ptr_conv.is_owned = false;
31145 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31146 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
31150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31151 LDKClosingSignedFeeRange this_ptr_conv;
31152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31153 this_ptr_conv.is_owned = false;
31154 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31155 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
31158 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) {
31159 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
31160 int64_t ret_ref = 0;
31161 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31162 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31163 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31164 ret_ref = (uintptr_t)ret_var.inner;
31165 if (ret_var.is_owned) {
31171 static inline uintptr_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
31172 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
31173 int64_t ret_ref = 0;
31174 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31175 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31176 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31177 ret_ref = (uintptr_t)ret_var.inner;
31178 if (ret_var.is_owned) {
31183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31184 LDKClosingSignedFeeRange arg_conv;
31185 arg_conv.inner = (void*)(arg & (~1));
31186 arg_conv.is_owned = false;
31187 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31188 int64_t ret_val = ClosingSignedFeeRange_clone_ptr(&arg_conv);
31192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31193 LDKClosingSignedFeeRange orig_conv;
31194 orig_conv.inner = (void*)(orig & (~1));
31195 orig_conv.is_owned = false;
31196 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31197 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
31198 int64_t ret_ref = 0;
31199 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31200 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31201 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31202 ret_ref = (uintptr_t)ret_var.inner;
31203 if (ret_var.is_owned) {
31209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31210 LDKClosingSigned this_obj_conv;
31211 this_obj_conv.inner = (void*)(this_obj & (~1));
31212 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31213 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31214 ClosingSigned_free(this_obj_conv);
31217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31218 LDKClosingSigned this_ptr_conv;
31219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31220 this_ptr_conv.is_owned = false;
31221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31222 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31223 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
31227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31228 LDKClosingSigned this_ptr_conv;
31229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31230 this_ptr_conv.is_owned = false;
31231 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31232 LDKThirtyTwoBytes val_ref;
31233 CHECK((*env)->GetArrayLength(env, val) == 32);
31234 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31235 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
31238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
31239 LDKClosingSigned this_ptr_conv;
31240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31241 this_ptr_conv.is_owned = false;
31242 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31243 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
31247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31248 LDKClosingSigned 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 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
31255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31256 LDKClosingSigned this_ptr_conv;
31257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31258 this_ptr_conv.is_owned = false;
31259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31260 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31261 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
31265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31266 LDKClosingSigned this_ptr_conv;
31267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31268 this_ptr_conv.is_owned = false;
31269 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31270 LDKSignature val_ref;
31271 CHECK((*env)->GetArrayLength(env, val) == 64);
31272 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31273 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
31276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
31277 LDKClosingSigned this_ptr_conv;
31278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31279 this_ptr_conv.is_owned = false;
31280 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31281 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
31282 int64_t ret_ref = 0;
31283 if ((uintptr_t)ret_var.inner > 4096) {
31284 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31285 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31286 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31287 ret_ref = (uintptr_t)ret_var.inner;
31288 if (ret_var.is_owned) {
31295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31296 LDKClosingSigned this_ptr_conv;
31297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31298 this_ptr_conv.is_owned = false;
31299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31300 LDKClosingSignedFeeRange val_conv;
31301 val_conv.inner = (void*)(val & (~1));
31302 val_conv.is_owned = (val & 1) || (val == 0);
31303 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31304 val_conv = ClosingSignedFeeRange_clone(&val_conv);
31305 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
31308 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) {
31309 LDKThirtyTwoBytes channel_id_arg_ref;
31310 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31311 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31312 LDKSignature signature_arg_ref;
31313 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31314 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31315 LDKClosingSignedFeeRange fee_range_arg_conv;
31316 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
31317 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
31318 CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
31319 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
31320 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
31321 int64_t ret_ref = 0;
31322 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31323 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31324 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31325 ret_ref = (uintptr_t)ret_var.inner;
31326 if (ret_var.is_owned) {
31332 static inline uintptr_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
31333 LDKClosingSigned ret_var = ClosingSigned_clone(arg);
31334 int64_t ret_ref = 0;
31335 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31336 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31337 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31338 ret_ref = (uintptr_t)ret_var.inner;
31339 if (ret_var.is_owned) {
31344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31345 LDKClosingSigned arg_conv;
31346 arg_conv.inner = (void*)(arg & (~1));
31347 arg_conv.is_owned = false;
31348 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31349 int64_t ret_val = ClosingSigned_clone_ptr(&arg_conv);
31353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31354 LDKClosingSigned orig_conv;
31355 orig_conv.inner = (void*)(orig & (~1));
31356 orig_conv.is_owned = false;
31357 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31358 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
31359 int64_t ret_ref = 0;
31360 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31361 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31362 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31363 ret_ref = (uintptr_t)ret_var.inner;
31364 if (ret_var.is_owned) {
31370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31371 LDKUpdateAddHTLC this_obj_conv;
31372 this_obj_conv.inner = (void*)(this_obj & (~1));
31373 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31374 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31375 UpdateAddHTLC_free(this_obj_conv);
31378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31379 LDKUpdateAddHTLC this_ptr_conv;
31380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31381 this_ptr_conv.is_owned = false;
31382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31383 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31384 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
31388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31389 LDKUpdateAddHTLC this_ptr_conv;
31390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31391 this_ptr_conv.is_owned = false;
31392 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31393 LDKThirtyTwoBytes val_ref;
31394 CHECK((*env)->GetArrayLength(env, val) == 32);
31395 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31396 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
31399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31400 LDKUpdateAddHTLC this_ptr_conv;
31401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31402 this_ptr_conv.is_owned = false;
31403 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31404 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
31408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31409 LDKUpdateAddHTLC this_ptr_conv;
31410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31411 this_ptr_conv.is_owned = false;
31412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31413 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
31416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
31417 LDKUpdateAddHTLC this_ptr_conv;
31418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31419 this_ptr_conv.is_owned = false;
31420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31421 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
31425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31426 LDKUpdateAddHTLC this_ptr_conv;
31427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31428 this_ptr_conv.is_owned = false;
31429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31430 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
31433 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
31434 LDKUpdateAddHTLC this_ptr_conv;
31435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31436 this_ptr_conv.is_owned = false;
31437 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31438 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31439 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
31443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31444 LDKUpdateAddHTLC 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 LDKThirtyTwoBytes val_ref;
31449 CHECK((*env)->GetArrayLength(env, val) == 32);
31450 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31451 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
31454 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
31455 LDKUpdateAddHTLC this_ptr_conv;
31456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31457 this_ptr_conv.is_owned = false;
31458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31459 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
31463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
31464 LDKUpdateAddHTLC this_ptr_conv;
31465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31466 this_ptr_conv.is_owned = false;
31467 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31468 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
31471 static inline uintptr_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
31472 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
31473 int64_t ret_ref = 0;
31474 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31475 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31476 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31477 ret_ref = (uintptr_t)ret_var.inner;
31478 if (ret_var.is_owned) {
31483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31484 LDKUpdateAddHTLC arg_conv;
31485 arg_conv.inner = (void*)(arg & (~1));
31486 arg_conv.is_owned = false;
31487 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31488 int64_t ret_val = UpdateAddHTLC_clone_ptr(&arg_conv);
31492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31493 LDKUpdateAddHTLC orig_conv;
31494 orig_conv.inner = (void*)(orig & (~1));
31495 orig_conv.is_owned = false;
31496 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31497 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
31498 int64_t ret_ref = 0;
31499 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31500 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31501 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31502 ret_ref = (uintptr_t)ret_var.inner;
31503 if (ret_var.is_owned) {
31509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31510 LDKUpdateFulfillHTLC this_obj_conv;
31511 this_obj_conv.inner = (void*)(this_obj & (~1));
31512 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31514 UpdateFulfillHTLC_free(this_obj_conv);
31517 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31518 LDKUpdateFulfillHTLC this_ptr_conv;
31519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31520 this_ptr_conv.is_owned = false;
31521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31522 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31523 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
31527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31528 LDKUpdateFulfillHTLC this_ptr_conv;
31529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31530 this_ptr_conv.is_owned = false;
31531 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31532 LDKThirtyTwoBytes val_ref;
31533 CHECK((*env)->GetArrayLength(env, val) == 32);
31534 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31535 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
31538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31539 LDKUpdateFulfillHTLC this_ptr_conv;
31540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31541 this_ptr_conv.is_owned = false;
31542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31543 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
31547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31548 LDKUpdateFulfillHTLC this_ptr_conv;
31549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31550 this_ptr_conv.is_owned = false;
31551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31552 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
31555 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
31556 LDKUpdateFulfillHTLC this_ptr_conv;
31557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31558 this_ptr_conv.is_owned = false;
31559 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31560 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31561 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
31565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31566 LDKUpdateFulfillHTLC this_ptr_conv;
31567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31568 this_ptr_conv.is_owned = false;
31569 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31570 LDKThirtyTwoBytes val_ref;
31571 CHECK((*env)->GetArrayLength(env, val) == 32);
31572 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31573 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
31576 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) {
31577 LDKThirtyTwoBytes channel_id_arg_ref;
31578 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31579 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31580 LDKThirtyTwoBytes payment_preimage_arg_ref;
31581 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
31582 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
31583 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
31584 int64_t ret_ref = 0;
31585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31588 ret_ref = (uintptr_t)ret_var.inner;
31589 if (ret_var.is_owned) {
31595 static inline uintptr_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
31596 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
31597 int64_t ret_ref = 0;
31598 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31599 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31600 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31601 ret_ref = (uintptr_t)ret_var.inner;
31602 if (ret_var.is_owned) {
31607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31608 LDKUpdateFulfillHTLC arg_conv;
31609 arg_conv.inner = (void*)(arg & (~1));
31610 arg_conv.is_owned = false;
31611 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31612 int64_t ret_val = UpdateFulfillHTLC_clone_ptr(&arg_conv);
31616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31617 LDKUpdateFulfillHTLC orig_conv;
31618 orig_conv.inner = (void*)(orig & (~1));
31619 orig_conv.is_owned = false;
31620 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31621 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
31622 int64_t ret_ref = 0;
31623 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31624 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31626 ret_ref = (uintptr_t)ret_var.inner;
31627 if (ret_var.is_owned) {
31633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31634 LDKUpdateFailHTLC this_obj_conv;
31635 this_obj_conv.inner = (void*)(this_obj & (~1));
31636 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31637 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31638 UpdateFailHTLC_free(this_obj_conv);
31641 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31642 LDKUpdateFailHTLC this_ptr_conv;
31643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31644 this_ptr_conv.is_owned = false;
31645 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31646 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31647 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
31651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31652 LDKUpdateFailHTLC this_ptr_conv;
31653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31654 this_ptr_conv.is_owned = false;
31655 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31656 LDKThirtyTwoBytes val_ref;
31657 CHECK((*env)->GetArrayLength(env, val) == 32);
31658 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31659 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
31662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31663 LDKUpdateFailHTLC this_ptr_conv;
31664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31665 this_ptr_conv.is_owned = false;
31666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31667 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
31671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31672 LDKUpdateFailHTLC this_ptr_conv;
31673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31674 this_ptr_conv.is_owned = false;
31675 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31676 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
31679 static inline uintptr_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
31680 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
31681 int64_t ret_ref = 0;
31682 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31683 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31684 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31685 ret_ref = (uintptr_t)ret_var.inner;
31686 if (ret_var.is_owned) {
31691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31692 LDKUpdateFailHTLC arg_conv;
31693 arg_conv.inner = (void*)(arg & (~1));
31694 arg_conv.is_owned = false;
31695 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31696 int64_t ret_val = UpdateFailHTLC_clone_ptr(&arg_conv);
31700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31701 LDKUpdateFailHTLC orig_conv;
31702 orig_conv.inner = (void*)(orig & (~1));
31703 orig_conv.is_owned = false;
31704 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31705 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
31706 int64_t ret_ref = 0;
31707 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31708 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31709 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31710 ret_ref = (uintptr_t)ret_var.inner;
31711 if (ret_var.is_owned) {
31717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31718 LDKUpdateFailMalformedHTLC this_obj_conv;
31719 this_obj_conv.inner = (void*)(this_obj & (~1));
31720 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31721 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31722 UpdateFailMalformedHTLC_free(this_obj_conv);
31725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31726 LDKUpdateFailMalformedHTLC this_ptr_conv;
31727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31728 this_ptr_conv.is_owned = false;
31729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31730 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31731 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
31735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31736 LDKUpdateFailMalformedHTLC this_ptr_conv;
31737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31738 this_ptr_conv.is_owned = false;
31739 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31740 LDKThirtyTwoBytes val_ref;
31741 CHECK((*env)->GetArrayLength(env, val) == 32);
31742 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31743 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
31746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31747 LDKUpdateFailMalformedHTLC this_ptr_conv;
31748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31749 this_ptr_conv.is_owned = false;
31750 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31751 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
31755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
31756 LDKUpdateFailMalformedHTLC this_ptr_conv;
31757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31758 this_ptr_conv.is_owned = false;
31759 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31760 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
31763 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
31764 LDKUpdateFailMalformedHTLC this_ptr_conv;
31765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31766 this_ptr_conv.is_owned = false;
31767 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31768 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
31772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
31773 LDKUpdateFailMalformedHTLC this_ptr_conv;
31774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31775 this_ptr_conv.is_owned = false;
31776 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31777 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
31780 static inline uintptr_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
31781 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
31782 int64_t ret_ref = 0;
31783 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31784 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31786 ret_ref = (uintptr_t)ret_var.inner;
31787 if (ret_var.is_owned) {
31792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31793 LDKUpdateFailMalformedHTLC arg_conv;
31794 arg_conv.inner = (void*)(arg & (~1));
31795 arg_conv.is_owned = false;
31796 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31797 int64_t ret_val = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
31801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31802 LDKUpdateFailMalformedHTLC orig_conv;
31803 orig_conv.inner = (void*)(orig & (~1));
31804 orig_conv.is_owned = false;
31805 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31806 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
31807 int64_t ret_ref = 0;
31808 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31809 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31810 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31811 ret_ref = (uintptr_t)ret_var.inner;
31812 if (ret_var.is_owned) {
31818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31819 LDKCommitmentSigned this_obj_conv;
31820 this_obj_conv.inner = (void*)(this_obj & (~1));
31821 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31822 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31823 CommitmentSigned_free(this_obj_conv);
31826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31827 LDKCommitmentSigned this_ptr_conv;
31828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31829 this_ptr_conv.is_owned = false;
31830 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31831 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31832 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
31836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31837 LDKCommitmentSigned this_ptr_conv;
31838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31839 this_ptr_conv.is_owned = false;
31840 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31841 LDKThirtyTwoBytes val_ref;
31842 CHECK((*env)->GetArrayLength(env, val) == 32);
31843 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31844 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
31847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
31848 LDKCommitmentSigned this_ptr_conv;
31849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31850 this_ptr_conv.is_owned = false;
31851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31852 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
31853 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
31857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31858 LDKCommitmentSigned this_ptr_conv;
31859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31860 this_ptr_conv.is_owned = false;
31861 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31862 LDKSignature val_ref;
31863 CHECK((*env)->GetArrayLength(env, val) == 64);
31864 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
31865 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
31868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
31869 LDKCommitmentSigned this_ptr_conv;
31870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31871 this_ptr_conv.is_owned = false;
31872 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31873 LDKCVec_SignatureZ val_constr;
31874 val_constr.datalen = (*env)->GetArrayLength(env, val);
31875 if (val_constr.datalen > 0)
31876 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
31878 val_constr.data = NULL;
31879 for (size_t i = 0; i < val_constr.datalen; i++) {
31880 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
31881 LDKSignature val_conv_8_ref;
31882 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
31883 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
31884 val_constr.data[i] = val_conv_8_ref;
31886 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
31889 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) {
31890 LDKThirtyTwoBytes channel_id_arg_ref;
31891 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
31892 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
31893 LDKSignature signature_arg_ref;
31894 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
31895 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
31896 LDKCVec_SignatureZ htlc_signatures_arg_constr;
31897 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
31898 if (htlc_signatures_arg_constr.datalen > 0)
31899 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
31901 htlc_signatures_arg_constr.data = NULL;
31902 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
31903 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
31904 LDKSignature htlc_signatures_arg_conv_8_ref;
31905 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
31906 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
31907 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
31909 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
31910 int64_t ret_ref = 0;
31911 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31912 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31913 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31914 ret_ref = (uintptr_t)ret_var.inner;
31915 if (ret_var.is_owned) {
31921 static inline uintptr_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
31922 LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
31923 int64_t ret_ref = 0;
31924 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31925 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31926 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31927 ret_ref = (uintptr_t)ret_var.inner;
31928 if (ret_var.is_owned) {
31933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31934 LDKCommitmentSigned arg_conv;
31935 arg_conv.inner = (void*)(arg & (~1));
31936 arg_conv.is_owned = false;
31937 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31938 int64_t ret_val = CommitmentSigned_clone_ptr(&arg_conv);
31942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31943 LDKCommitmentSigned orig_conv;
31944 orig_conv.inner = (void*)(orig & (~1));
31945 orig_conv.is_owned = false;
31946 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31947 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
31948 int64_t ret_ref = 0;
31949 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
31950 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
31951 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31952 ret_ref = (uintptr_t)ret_var.inner;
31953 if (ret_var.is_owned) {
31959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
31960 LDKRevokeAndACK this_obj_conv;
31961 this_obj_conv.inner = (void*)(this_obj & (~1));
31962 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
31963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31964 RevokeAndACK_free(this_obj_conv);
31967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
31968 LDKRevokeAndACK this_ptr_conv;
31969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31970 this_ptr_conv.is_owned = false;
31971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31972 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31973 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
31977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31978 LDKRevokeAndACK this_ptr_conv;
31979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
31980 this_ptr_conv.is_owned = false;
31981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31982 LDKThirtyTwoBytes val_ref;
31983 CHECK((*env)->GetArrayLength(env, val) == 32);
31984 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
31985 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
31988 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
31989 LDKRevokeAndACK 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 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
31994 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
31998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
31999 LDKRevokeAndACK this_ptr_conv;
32000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32001 this_ptr_conv.is_owned = false;
32002 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32003 LDKThirtyTwoBytes val_ref;
32004 CHECK((*env)->GetArrayLength(env, val) == 32);
32005 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32006 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
32009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32010 LDKRevokeAndACK this_ptr_conv;
32011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32012 this_ptr_conv.is_owned = false;
32013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32014 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32015 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
32019 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) {
32020 LDKRevokeAndACK this_ptr_conv;
32021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32022 this_ptr_conv.is_owned = false;
32023 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32024 LDKPublicKey val_ref;
32025 CHECK((*env)->GetArrayLength(env, val) == 33);
32026 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32027 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
32030 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) {
32031 LDKThirtyTwoBytes channel_id_arg_ref;
32032 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32033 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32034 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
32035 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
32036 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
32037 LDKPublicKey next_per_commitment_point_arg_ref;
32038 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
32039 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
32040 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
32041 int64_t ret_ref = 0;
32042 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32043 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32044 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32045 ret_ref = (uintptr_t)ret_var.inner;
32046 if (ret_var.is_owned) {
32052 static inline uintptr_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
32053 LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
32054 int64_t ret_ref = 0;
32055 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32056 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32057 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32058 ret_ref = (uintptr_t)ret_var.inner;
32059 if (ret_var.is_owned) {
32064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32065 LDKRevokeAndACK arg_conv;
32066 arg_conv.inner = (void*)(arg & (~1));
32067 arg_conv.is_owned = false;
32068 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32069 int64_t ret_val = RevokeAndACK_clone_ptr(&arg_conv);
32073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32074 LDKRevokeAndACK orig_conv;
32075 orig_conv.inner = (void*)(orig & (~1));
32076 orig_conv.is_owned = false;
32077 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32078 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
32079 int64_t ret_ref = 0;
32080 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32081 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32082 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32083 ret_ref = (uintptr_t)ret_var.inner;
32084 if (ret_var.is_owned) {
32090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32091 LDKUpdateFee this_obj_conv;
32092 this_obj_conv.inner = (void*)(this_obj & (~1));
32093 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32095 UpdateFee_free(this_obj_conv);
32098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32099 LDKUpdateFee this_ptr_conv;
32100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32101 this_ptr_conv.is_owned = false;
32102 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32103 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32104 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
32108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32109 LDKUpdateFee this_ptr_conv;
32110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32111 this_ptr_conv.is_owned = false;
32112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32113 LDKThirtyTwoBytes val_ref;
32114 CHECK((*env)->GetArrayLength(env, val) == 32);
32115 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32116 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
32119 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
32120 LDKUpdateFee this_ptr_conv;
32121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32122 this_ptr_conv.is_owned = false;
32123 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32124 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
32128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32129 LDKUpdateFee 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 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
32136 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) {
32137 LDKThirtyTwoBytes channel_id_arg_ref;
32138 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32139 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32140 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
32141 int64_t ret_ref = 0;
32142 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32143 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32144 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32145 ret_ref = (uintptr_t)ret_var.inner;
32146 if (ret_var.is_owned) {
32152 static inline uintptr_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
32153 LDKUpdateFee ret_var = UpdateFee_clone(arg);
32154 int64_t ret_ref = 0;
32155 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32156 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32157 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32158 ret_ref = (uintptr_t)ret_var.inner;
32159 if (ret_var.is_owned) {
32164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32165 LDKUpdateFee arg_conv;
32166 arg_conv.inner = (void*)(arg & (~1));
32167 arg_conv.is_owned = false;
32168 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32169 int64_t ret_val = UpdateFee_clone_ptr(&arg_conv);
32173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32174 LDKUpdateFee orig_conv;
32175 orig_conv.inner = (void*)(orig & (~1));
32176 orig_conv.is_owned = false;
32177 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32178 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
32179 int64_t ret_ref = 0;
32180 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32181 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32182 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32183 ret_ref = (uintptr_t)ret_var.inner;
32184 if (ret_var.is_owned) {
32190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32191 LDKDataLossProtect this_obj_conv;
32192 this_obj_conv.inner = (void*)(this_obj & (~1));
32193 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32195 DataLossProtect_free(this_obj_conv);
32198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
32199 LDKDataLossProtect this_ptr_conv;
32200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32201 this_ptr_conv.is_owned = false;
32202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32203 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32204 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
32208 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) {
32209 LDKDataLossProtect this_ptr_conv;
32210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32211 this_ptr_conv.is_owned = false;
32212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32213 LDKThirtyTwoBytes val_ref;
32214 CHECK((*env)->GetArrayLength(env, val) == 32);
32215 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32216 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
32219 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
32220 LDKDataLossProtect this_ptr_conv;
32221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32222 this_ptr_conv.is_owned = false;
32223 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32224 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32225 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
32229 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) {
32230 LDKDataLossProtect this_ptr_conv;
32231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32232 this_ptr_conv.is_owned = false;
32233 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32234 LDKPublicKey val_ref;
32235 CHECK((*env)->GetArrayLength(env, val) == 33);
32236 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32237 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
32240 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) {
32241 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
32242 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
32243 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
32244 LDKPublicKey my_current_per_commitment_point_arg_ref;
32245 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
32246 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
32247 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
32248 int64_t ret_ref = 0;
32249 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32250 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32251 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32252 ret_ref = (uintptr_t)ret_var.inner;
32253 if (ret_var.is_owned) {
32259 static inline uintptr_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
32260 LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
32261 int64_t ret_ref = 0;
32262 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32263 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32264 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32265 ret_ref = (uintptr_t)ret_var.inner;
32266 if (ret_var.is_owned) {
32271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32272 LDKDataLossProtect arg_conv;
32273 arg_conv.inner = (void*)(arg & (~1));
32274 arg_conv.is_owned = false;
32275 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32276 int64_t ret_val = DataLossProtect_clone_ptr(&arg_conv);
32280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32281 LDKDataLossProtect orig_conv;
32282 orig_conv.inner = (void*)(orig & (~1));
32283 orig_conv.is_owned = false;
32284 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32285 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
32286 int64_t ret_ref = 0;
32287 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32288 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32289 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32290 ret_ref = (uintptr_t)ret_var.inner;
32291 if (ret_var.is_owned) {
32297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32298 LDKChannelReestablish this_obj_conv;
32299 this_obj_conv.inner = (void*)(this_obj & (~1));
32300 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32301 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32302 ChannelReestablish_free(this_obj_conv);
32305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32306 LDKChannelReestablish this_ptr_conv;
32307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32308 this_ptr_conv.is_owned = false;
32309 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32310 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32311 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
32315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32316 LDKChannelReestablish this_ptr_conv;
32317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32318 this_ptr_conv.is_owned = false;
32319 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32320 LDKThirtyTwoBytes val_ref;
32321 CHECK((*env)->GetArrayLength(env, val) == 32);
32322 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32323 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
32326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
32327 LDKChannelReestablish 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 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
32335 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) {
32336 LDKChannelReestablish 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 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
32343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
32344 LDKChannelReestablish this_ptr_conv;
32345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32346 this_ptr_conv.is_owned = false;
32347 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32348 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
32352 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) {
32353 LDKChannelReestablish this_ptr_conv;
32354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32355 this_ptr_conv.is_owned = false;
32356 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32357 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
32360 static inline uintptr_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
32361 LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
32362 int64_t ret_ref = 0;
32363 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32364 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32366 ret_ref = (uintptr_t)ret_var.inner;
32367 if (ret_var.is_owned) {
32372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32373 LDKChannelReestablish arg_conv;
32374 arg_conv.inner = (void*)(arg & (~1));
32375 arg_conv.is_owned = false;
32376 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32377 int64_t ret_val = ChannelReestablish_clone_ptr(&arg_conv);
32381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32382 LDKChannelReestablish orig_conv;
32383 orig_conv.inner = (void*)(orig & (~1));
32384 orig_conv.is_owned = false;
32385 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32386 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
32387 int64_t ret_ref = 0;
32388 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32389 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32391 ret_ref = (uintptr_t)ret_var.inner;
32392 if (ret_var.is_owned) {
32398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32399 LDKAnnouncementSignatures this_obj_conv;
32400 this_obj_conv.inner = (void*)(this_obj & (~1));
32401 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32403 AnnouncementSignatures_free(this_obj_conv);
32406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32407 LDKAnnouncementSignatures this_ptr_conv;
32408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32409 this_ptr_conv.is_owned = false;
32410 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32411 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32412 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
32416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32417 LDKAnnouncementSignatures this_ptr_conv;
32418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32419 this_ptr_conv.is_owned = false;
32420 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32421 LDKThirtyTwoBytes val_ref;
32422 CHECK((*env)->GetArrayLength(env, val) == 32);
32423 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32424 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
32427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32428 LDKAnnouncementSignatures this_ptr_conv;
32429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32430 this_ptr_conv.is_owned = false;
32431 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32432 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
32436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32437 LDKAnnouncementSignatures this_ptr_conv;
32438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32439 this_ptr_conv.is_owned = false;
32440 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32441 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
32444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32445 LDKAnnouncementSignatures this_ptr_conv;
32446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32447 this_ptr_conv.is_owned = false;
32448 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32449 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32450 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
32454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32455 LDKAnnouncementSignatures this_ptr_conv;
32456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32457 this_ptr_conv.is_owned = false;
32458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32459 LDKSignature val_ref;
32460 CHECK((*env)->GetArrayLength(env, val) == 64);
32461 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32462 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
32465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32466 LDKAnnouncementSignatures this_ptr_conv;
32467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32468 this_ptr_conv.is_owned = false;
32469 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32470 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32471 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
32475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32476 LDKAnnouncementSignatures this_ptr_conv;
32477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32478 this_ptr_conv.is_owned = false;
32479 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32480 LDKSignature val_ref;
32481 CHECK((*env)->GetArrayLength(env, val) == 64);
32482 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32483 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
32486 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) {
32487 LDKThirtyTwoBytes channel_id_arg_ref;
32488 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
32489 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
32490 LDKSignature node_signature_arg_ref;
32491 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
32492 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
32493 LDKSignature bitcoin_signature_arg_ref;
32494 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
32495 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
32496 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
32497 int64_t ret_ref = 0;
32498 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32499 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32500 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32501 ret_ref = (uintptr_t)ret_var.inner;
32502 if (ret_var.is_owned) {
32508 static inline uintptr_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
32509 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
32510 int64_t ret_ref = 0;
32511 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32512 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32513 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32514 ret_ref = (uintptr_t)ret_var.inner;
32515 if (ret_var.is_owned) {
32520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32521 LDKAnnouncementSignatures arg_conv;
32522 arg_conv.inner = (void*)(arg & (~1));
32523 arg_conv.is_owned = false;
32524 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32525 int64_t ret_val = AnnouncementSignatures_clone_ptr(&arg_conv);
32529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32530 LDKAnnouncementSignatures orig_conv;
32531 orig_conv.inner = (void*)(orig & (~1));
32532 orig_conv.is_owned = false;
32533 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32534 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
32535 int64_t ret_ref = 0;
32536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32539 ret_ref = (uintptr_t)ret_var.inner;
32540 if (ret_var.is_owned) {
32546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
32547 if ((this_ptr & 1) != 0) return;
32548 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
32549 CHECK_ACCESS(this_ptr_ptr);
32550 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
32551 FREE((void*)this_ptr);
32552 NetAddress_free(this_ptr_conv);
32555 static inline uintptr_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
32556 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32557 *ret_copy = NetAddress_clone(arg);
32558 int64_t ret_ref = (uintptr_t)ret_copy;
32561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32562 LDKNetAddress* arg_conv = (LDKNetAddress*)arg;
32563 int64_t ret_val = NetAddress_clone_ptr(arg_conv);
32567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32568 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
32569 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32570 *ret_copy = NetAddress_clone(orig_conv);
32571 int64_t ret_ref = (uintptr_t)ret_copy;
32575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
32576 LDKFourBytes addr_ref;
32577 CHECK((*env)->GetArrayLength(env, addr) == 4);
32578 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
32579 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32580 *ret_copy = NetAddress_ipv4(addr_ref, port);
32581 int64_t ret_ref = (uintptr_t)ret_copy;
32585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
32586 LDKSixteenBytes addr_ref;
32587 CHECK((*env)->GetArrayLength(env, addr) == 16);
32588 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
32589 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32590 *ret_copy = NetAddress_ipv6(addr_ref, port);
32591 int64_t ret_ref = (uintptr_t)ret_copy;
32595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
32596 LDKTwelveBytes a_ref;
32597 CHECK((*env)->GetArrayLength(env, a) == 12);
32598 (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
32599 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32600 *ret_copy = NetAddress_onion_v2(a_ref);
32601 int64_t ret_ref = (uintptr_t)ret_copy;
32605 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) {
32606 LDKThirtyTwoBytes ed25519_pubkey_ref;
32607 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
32608 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
32609 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
32610 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
32611 int64_t ret_ref = (uintptr_t)ret_copy;
32615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
32616 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
32617 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
32618 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
32619 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
32620 CVec_u8Z_free(ret_var);
32624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
32625 LDKu8slice ser_ref;
32626 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
32627 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
32628 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
32629 *ret_conv = NetAddress_read(ser_ref);
32630 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
32631 return (int64_t)ret_conv;
32634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32635 LDKUnsignedNodeAnnouncement this_obj_conv;
32636 this_obj_conv.inner = (void*)(this_obj & (~1));
32637 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32638 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32639 UnsignedNodeAnnouncement_free(this_obj_conv);
32642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
32643 LDKUnsignedNodeAnnouncement this_ptr_conv;
32644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32645 this_ptr_conv.is_owned = false;
32646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32647 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
32648 int64_t ret_ref = 0;
32649 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32650 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32651 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32652 ret_ref = (uintptr_t)ret_var.inner;
32653 if (ret_var.is_owned) {
32659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32660 LDKUnsignedNodeAnnouncement this_ptr_conv;
32661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32662 this_ptr_conv.is_owned = false;
32663 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32664 LDKNodeFeatures val_conv;
32665 val_conv.inner = (void*)(val & (~1));
32666 val_conv.is_owned = (val & 1) || (val == 0);
32667 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32668 val_conv = NodeFeatures_clone(&val_conv);
32669 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
32672 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
32673 LDKUnsignedNodeAnnouncement this_ptr_conv;
32674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32675 this_ptr_conv.is_owned = false;
32676 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32677 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
32681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
32682 LDKUnsignedNodeAnnouncement this_ptr_conv;
32683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32684 this_ptr_conv.is_owned = false;
32685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32686 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
32689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32690 LDKUnsignedNodeAnnouncement this_ptr_conv;
32691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32692 this_ptr_conv.is_owned = false;
32693 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32694 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
32695 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
32699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32700 LDKUnsignedNodeAnnouncement this_ptr_conv;
32701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32702 this_ptr_conv.is_owned = false;
32703 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32704 LDKPublicKey val_ref;
32705 CHECK((*env)->GetArrayLength(env, val) == 33);
32706 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
32707 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
32710 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
32711 LDKUnsignedNodeAnnouncement this_ptr_conv;
32712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32713 this_ptr_conv.is_owned = false;
32714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32715 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
32716 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
32720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32721 LDKUnsignedNodeAnnouncement this_ptr_conv;
32722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32723 this_ptr_conv.is_owned = false;
32724 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32725 LDKThreeBytes val_ref;
32726 CHECK((*env)->GetArrayLength(env, val) == 3);
32727 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
32728 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
32731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
32732 LDKUnsignedNodeAnnouncement this_ptr_conv;
32733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32734 this_ptr_conv.is_owned = false;
32735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32736 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32737 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
32741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32742 LDKUnsignedNodeAnnouncement this_ptr_conv;
32743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32744 this_ptr_conv.is_owned = false;
32745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32746 LDKThirtyTwoBytes val_ref;
32747 CHECK((*env)->GetArrayLength(env, val) == 32);
32748 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32749 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
32752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
32753 LDKUnsignedNodeAnnouncement this_ptr_conv;
32754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32755 this_ptr_conv.is_owned = false;
32756 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32757 LDKCVec_NetAddressZ val_constr;
32758 val_constr.datalen = (*env)->GetArrayLength(env, val);
32759 if (val_constr.datalen > 0)
32760 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
32762 val_constr.data = NULL;
32763 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
32764 for (size_t m = 0; m < val_constr.datalen; m++) {
32765 int64_t val_conv_12 = val_vals[m];
32766 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
32767 CHECK_ACCESS(val_conv_12_ptr);
32768 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
32769 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
32770 val_constr.data[m] = val_conv_12_conv;
32772 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
32773 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
32776 static inline uintptr_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
32777 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
32778 int64_t ret_ref = 0;
32779 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32780 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32781 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32782 ret_ref = (uintptr_t)ret_var.inner;
32783 if (ret_var.is_owned) {
32788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32789 LDKUnsignedNodeAnnouncement arg_conv;
32790 arg_conv.inner = (void*)(arg & (~1));
32791 arg_conv.is_owned = false;
32792 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32793 int64_t ret_val = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
32797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32798 LDKUnsignedNodeAnnouncement orig_conv;
32799 orig_conv.inner = (void*)(orig & (~1));
32800 orig_conv.is_owned = false;
32801 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32802 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
32803 int64_t ret_ref = 0;
32804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32807 ret_ref = (uintptr_t)ret_var.inner;
32808 if (ret_var.is_owned) {
32814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32815 LDKNodeAnnouncement this_obj_conv;
32816 this_obj_conv.inner = (void*)(this_obj & (~1));
32817 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32818 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32819 NodeAnnouncement_free(this_obj_conv);
32822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
32823 LDKNodeAnnouncement this_ptr_conv;
32824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32825 this_ptr_conv.is_owned = false;
32826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32827 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
32828 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
32832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32833 LDKNodeAnnouncement this_ptr_conv;
32834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32835 this_ptr_conv.is_owned = false;
32836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32837 LDKSignature val_ref;
32838 CHECK((*env)->GetArrayLength(env, val) == 64);
32839 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
32840 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
32843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
32844 LDKNodeAnnouncement this_ptr_conv;
32845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32846 this_ptr_conv.is_owned = false;
32847 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32848 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_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_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32861 LDKNodeAnnouncement this_ptr_conv;
32862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32863 this_ptr_conv.is_owned = false;
32864 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32865 LDKUnsignedNodeAnnouncement val_conv;
32866 val_conv.inner = (void*)(val & (~1));
32867 val_conv.is_owned = (val & 1) || (val == 0);
32868 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32869 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
32870 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
32873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
32874 LDKSignature signature_arg_ref;
32875 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
32876 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
32877 LDKUnsignedNodeAnnouncement contents_arg_conv;
32878 contents_arg_conv.inner = (void*)(contents_arg & (~1));
32879 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
32880 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32881 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
32882 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
32883 int64_t ret_ref = 0;
32884 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32885 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32886 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32887 ret_ref = (uintptr_t)ret_var.inner;
32888 if (ret_var.is_owned) {
32894 static inline uintptr_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
32895 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
32896 int64_t ret_ref = 0;
32897 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32898 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32900 ret_ref = (uintptr_t)ret_var.inner;
32901 if (ret_var.is_owned) {
32906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32907 LDKNodeAnnouncement arg_conv;
32908 arg_conv.inner = (void*)(arg & (~1));
32909 arg_conv.is_owned = false;
32910 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32911 int64_t ret_val = NodeAnnouncement_clone_ptr(&arg_conv);
32915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32916 LDKNodeAnnouncement orig_conv;
32917 orig_conv.inner = (void*)(orig & (~1));
32918 orig_conv.is_owned = false;
32919 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32920 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
32921 int64_t ret_ref = 0;
32922 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32923 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32924 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32925 ret_ref = (uintptr_t)ret_var.inner;
32926 if (ret_var.is_owned) {
32932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
32933 LDKUnsignedChannelAnnouncement this_obj_conv;
32934 this_obj_conv.inner = (void*)(this_obj & (~1));
32935 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
32936 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32937 UnsignedChannelAnnouncement_free(this_obj_conv);
32940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
32941 LDKUnsignedChannelAnnouncement this_ptr_conv;
32942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32943 this_ptr_conv.is_owned = false;
32944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32945 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
32946 int64_t ret_ref = 0;
32947 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
32948 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
32949 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32950 ret_ref = (uintptr_t)ret_var.inner;
32951 if (ret_var.is_owned) {
32957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
32958 LDKUnsignedChannelAnnouncement this_ptr_conv;
32959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32960 this_ptr_conv.is_owned = false;
32961 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32962 LDKChannelFeatures val_conv;
32963 val_conv.inner = (void*)(val & (~1));
32964 val_conv.is_owned = (val & 1) || (val == 0);
32965 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32966 val_conv = ChannelFeatures_clone(&val_conv);
32967 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
32970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
32971 LDKUnsignedChannelAnnouncement this_ptr_conv;
32972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32973 this_ptr_conv.is_owned = false;
32974 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32975 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
32976 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
32980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
32981 LDKUnsignedChannelAnnouncement this_ptr_conv;
32982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32983 this_ptr_conv.is_owned = false;
32984 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32985 LDKThirtyTwoBytes val_ref;
32986 CHECK((*env)->GetArrayLength(env, val) == 32);
32987 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
32988 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
32991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
32992 LDKUnsignedChannelAnnouncement this_ptr_conv;
32993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
32994 this_ptr_conv.is_owned = false;
32995 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32996 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
33000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33001 LDKUnsignedChannelAnnouncement this_ptr_conv;
33002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33003 this_ptr_conv.is_owned = false;
33004 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33005 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
33008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33009 LDKUnsignedChannelAnnouncement this_ptr_conv;
33010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33011 this_ptr_conv.is_owned = false;
33012 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33013 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33014 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
33018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33019 LDKUnsignedChannelAnnouncement this_ptr_conv;
33020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33021 this_ptr_conv.is_owned = false;
33022 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33023 LDKPublicKey val_ref;
33024 CHECK((*env)->GetArrayLength(env, val) == 33);
33025 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33026 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
33029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33030 LDKUnsignedChannelAnnouncement this_ptr_conv;
33031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33032 this_ptr_conv.is_owned = false;
33033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33034 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33035 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
33039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33040 LDKUnsignedChannelAnnouncement this_ptr_conv;
33041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33042 this_ptr_conv.is_owned = false;
33043 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33044 LDKPublicKey val_ref;
33045 CHECK((*env)->GetArrayLength(env, val) == 33);
33046 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33047 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
33050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33051 LDKUnsignedChannelAnnouncement this_ptr_conv;
33052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33053 this_ptr_conv.is_owned = false;
33054 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33055 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33056 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
33060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33061 LDKUnsignedChannelAnnouncement this_ptr_conv;
33062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33063 this_ptr_conv.is_owned = false;
33064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33065 LDKPublicKey val_ref;
33066 CHECK((*env)->GetArrayLength(env, val) == 33);
33067 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33068 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
33071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33072 LDKUnsignedChannelAnnouncement this_ptr_conv;
33073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33074 this_ptr_conv.is_owned = false;
33075 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33076 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
33077 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
33081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33082 LDKUnsignedChannelAnnouncement this_ptr_conv;
33083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33084 this_ptr_conv.is_owned = false;
33085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33086 LDKPublicKey val_ref;
33087 CHECK((*env)->GetArrayLength(env, val) == 33);
33088 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
33089 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
33092 static inline uintptr_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
33093 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
33094 int64_t ret_ref = 0;
33095 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33096 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33097 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33098 ret_ref = (uintptr_t)ret_var.inner;
33099 if (ret_var.is_owned) {
33104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33105 LDKUnsignedChannelAnnouncement arg_conv;
33106 arg_conv.inner = (void*)(arg & (~1));
33107 arg_conv.is_owned = false;
33108 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33109 int64_t ret_val = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
33113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33114 LDKUnsignedChannelAnnouncement orig_conv;
33115 orig_conv.inner = (void*)(orig & (~1));
33116 orig_conv.is_owned = false;
33117 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33118 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
33119 int64_t ret_ref = 0;
33120 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33121 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33122 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33123 ret_ref = (uintptr_t)ret_var.inner;
33124 if (ret_var.is_owned) {
33130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33131 LDKChannelAnnouncement this_obj_conv;
33132 this_obj_conv.inner = (void*)(this_obj & (~1));
33133 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33135 ChannelAnnouncement_free(this_obj_conv);
33138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33139 LDKChannelAnnouncement this_ptr_conv;
33140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33141 this_ptr_conv.is_owned = false;
33142 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33143 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33144 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
33148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33149 LDKChannelAnnouncement this_ptr_conv;
33150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33151 this_ptr_conv.is_owned = false;
33152 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33153 LDKSignature val_ref;
33154 CHECK((*env)->GetArrayLength(env, val) == 64);
33155 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33156 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
33159 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33160 LDKChannelAnnouncement this_ptr_conv;
33161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33162 this_ptr_conv.is_owned = false;
33163 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33164 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33165 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
33169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33170 LDKChannelAnnouncement this_ptr_conv;
33171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33172 this_ptr_conv.is_owned = false;
33173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33174 LDKSignature val_ref;
33175 CHECK((*env)->GetArrayLength(env, val) == 64);
33176 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33177 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
33180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
33181 LDKChannelAnnouncement this_ptr_conv;
33182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33183 this_ptr_conv.is_owned = false;
33184 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33185 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33186 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
33190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33191 LDKChannelAnnouncement this_ptr_conv;
33192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33193 this_ptr_conv.is_owned = false;
33194 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33195 LDKSignature val_ref;
33196 CHECK((*env)->GetArrayLength(env, val) == 64);
33197 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33198 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
33201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
33202 LDKChannelAnnouncement this_ptr_conv;
33203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33204 this_ptr_conv.is_owned = false;
33205 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33206 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33207 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
33211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33212 LDKChannelAnnouncement this_ptr_conv;
33213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33214 this_ptr_conv.is_owned = false;
33215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33216 LDKSignature val_ref;
33217 CHECK((*env)->GetArrayLength(env, val) == 64);
33218 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33219 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
33222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
33223 LDKChannelAnnouncement 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 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
33228 int64_t ret_ref = 0;
33229 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33230 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33232 ret_ref = (uintptr_t)ret_var.inner;
33233 if (ret_var.is_owned) {
33239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33240 LDKChannelAnnouncement this_ptr_conv;
33241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33242 this_ptr_conv.is_owned = false;
33243 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33244 LDKUnsignedChannelAnnouncement val_conv;
33245 val_conv.inner = (void*)(val & (~1));
33246 val_conv.is_owned = (val & 1) || (val == 0);
33247 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33248 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
33249 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
33252 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) {
33253 LDKSignature node_signature_1_arg_ref;
33254 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
33255 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
33256 LDKSignature node_signature_2_arg_ref;
33257 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
33258 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
33259 LDKSignature bitcoin_signature_1_arg_ref;
33260 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
33261 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
33262 LDKSignature bitcoin_signature_2_arg_ref;
33263 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
33264 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
33265 LDKUnsignedChannelAnnouncement contents_arg_conv;
33266 contents_arg_conv.inner = (void*)(contents_arg & (~1));
33267 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
33268 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33269 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
33270 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);
33271 int64_t ret_ref = 0;
33272 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33273 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33274 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33275 ret_ref = (uintptr_t)ret_var.inner;
33276 if (ret_var.is_owned) {
33282 static inline uintptr_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
33283 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
33284 int64_t ret_ref = 0;
33285 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33286 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33287 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33288 ret_ref = (uintptr_t)ret_var.inner;
33289 if (ret_var.is_owned) {
33294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33295 LDKChannelAnnouncement arg_conv;
33296 arg_conv.inner = (void*)(arg & (~1));
33297 arg_conv.is_owned = false;
33298 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33299 int64_t ret_val = ChannelAnnouncement_clone_ptr(&arg_conv);
33303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33304 LDKChannelAnnouncement orig_conv;
33305 orig_conv.inner = (void*)(orig & (~1));
33306 orig_conv.is_owned = false;
33307 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33308 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
33309 int64_t ret_ref = 0;
33310 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33311 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33312 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33313 ret_ref = (uintptr_t)ret_var.inner;
33314 if (ret_var.is_owned) {
33320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33321 LDKUnsignedChannelUpdate this_obj_conv;
33322 this_obj_conv.inner = (void*)(this_obj & (~1));
33323 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33324 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33325 UnsignedChannelUpdate_free(this_obj_conv);
33328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33329 LDKUnsignedChannelUpdate this_ptr_conv;
33330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33331 this_ptr_conv.is_owned = false;
33332 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33333 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33334 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
33338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33339 LDKUnsignedChannelUpdate this_ptr_conv;
33340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33341 this_ptr_conv.is_owned = false;
33342 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33343 LDKThirtyTwoBytes val_ref;
33344 CHECK((*env)->GetArrayLength(env, val) == 32);
33345 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33346 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
33349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
33350 LDKUnsignedChannelUpdate this_ptr_conv;
33351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33352 this_ptr_conv.is_owned = false;
33353 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33354 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
33358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33359 LDKUnsignedChannelUpdate this_ptr_conv;
33360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33361 this_ptr_conv.is_owned = false;
33362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33363 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
33366 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
33367 LDKUnsignedChannelUpdate this_ptr_conv;
33368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33369 this_ptr_conv.is_owned = false;
33370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33371 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
33375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33376 LDKUnsignedChannelUpdate this_ptr_conv;
33377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33378 this_ptr_conv.is_owned = false;
33379 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33380 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
33383 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
33384 LDKUnsignedChannelUpdate this_ptr_conv;
33385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33386 this_ptr_conv.is_owned = false;
33387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33388 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
33392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
33393 LDKUnsignedChannelUpdate this_ptr_conv;
33394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33395 this_ptr_conv.is_owned = false;
33396 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33397 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
33400 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
33401 LDKUnsignedChannelUpdate this_ptr_conv;
33402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33403 this_ptr_conv.is_owned = false;
33404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33405 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
33409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
33410 LDKUnsignedChannelUpdate this_ptr_conv;
33411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33412 this_ptr_conv.is_owned = false;
33413 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33414 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
33417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33418 LDKUnsignedChannelUpdate this_ptr_conv;
33419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33420 this_ptr_conv.is_owned = false;
33421 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33422 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
33426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33427 LDKUnsignedChannelUpdate this_ptr_conv;
33428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33429 this_ptr_conv.is_owned = false;
33430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33431 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
33434 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
33435 LDKUnsignedChannelUpdate this_ptr_conv;
33436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33437 this_ptr_conv.is_owned = false;
33438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33439 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
33443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33444 LDKUnsignedChannelUpdate this_ptr_conv;
33445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33446 this_ptr_conv.is_owned = false;
33447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33448 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
33451 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
33452 LDKUnsignedChannelUpdate this_ptr_conv;
33453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33454 this_ptr_conv.is_owned = false;
33455 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33456 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
33460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33461 LDKUnsignedChannelUpdate this_ptr_conv;
33462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33463 this_ptr_conv.is_owned = false;
33464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33465 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
33468 static inline uintptr_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
33469 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
33470 int64_t ret_ref = 0;
33471 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33472 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33473 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33474 ret_ref = (uintptr_t)ret_var.inner;
33475 if (ret_var.is_owned) {
33480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33481 LDKUnsignedChannelUpdate arg_conv;
33482 arg_conv.inner = (void*)(arg & (~1));
33483 arg_conv.is_owned = false;
33484 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33485 int64_t ret_val = UnsignedChannelUpdate_clone_ptr(&arg_conv);
33489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33490 LDKUnsignedChannelUpdate orig_conv;
33491 orig_conv.inner = (void*)(orig & (~1));
33492 orig_conv.is_owned = false;
33493 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33494 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
33495 int64_t ret_ref = 0;
33496 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33497 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33498 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33499 ret_ref = (uintptr_t)ret_var.inner;
33500 if (ret_var.is_owned) {
33506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33507 LDKChannelUpdate this_obj_conv;
33508 this_obj_conv.inner = (void*)(this_obj & (~1));
33509 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33511 ChannelUpdate_free(this_obj_conv);
33514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
33515 LDKChannelUpdate this_ptr_conv;
33516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33517 this_ptr_conv.is_owned = false;
33518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33519 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
33520 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
33524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33525 LDKChannelUpdate this_ptr_conv;
33526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33527 this_ptr_conv.is_owned = false;
33528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33529 LDKSignature val_ref;
33530 CHECK((*env)->GetArrayLength(env, val) == 64);
33531 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
33532 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
33535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
33536 LDKChannelUpdate this_ptr_conv;
33537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33538 this_ptr_conv.is_owned = false;
33539 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33540 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
33541 int64_t ret_ref = 0;
33542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33545 ret_ref = (uintptr_t)ret_var.inner;
33546 if (ret_var.is_owned) {
33552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
33553 LDKChannelUpdate this_ptr_conv;
33554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33555 this_ptr_conv.is_owned = false;
33556 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33557 LDKUnsignedChannelUpdate val_conv;
33558 val_conv.inner = (void*)(val & (~1));
33559 val_conv.is_owned = (val & 1) || (val == 0);
33560 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33561 val_conv = UnsignedChannelUpdate_clone(&val_conv);
33562 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
33565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
33566 LDKSignature signature_arg_ref;
33567 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
33568 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
33569 LDKUnsignedChannelUpdate contents_arg_conv;
33570 contents_arg_conv.inner = (void*)(contents_arg & (~1));
33571 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
33572 CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33573 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
33574 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
33575 int64_t ret_ref = 0;
33576 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33577 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33578 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33579 ret_ref = (uintptr_t)ret_var.inner;
33580 if (ret_var.is_owned) {
33586 static inline uintptr_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
33587 LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
33588 int64_t ret_ref = 0;
33589 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33590 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33591 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33592 ret_ref = (uintptr_t)ret_var.inner;
33593 if (ret_var.is_owned) {
33598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33599 LDKChannelUpdate arg_conv;
33600 arg_conv.inner = (void*)(arg & (~1));
33601 arg_conv.is_owned = false;
33602 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33603 int64_t ret_val = ChannelUpdate_clone_ptr(&arg_conv);
33607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33608 LDKChannelUpdate orig_conv;
33609 orig_conv.inner = (void*)(orig & (~1));
33610 orig_conv.is_owned = false;
33611 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33612 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
33613 int64_t ret_ref = 0;
33614 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33615 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33616 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33617 ret_ref = (uintptr_t)ret_var.inner;
33618 if (ret_var.is_owned) {
33624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33625 LDKQueryChannelRange this_obj_conv;
33626 this_obj_conv.inner = (void*)(this_obj & (~1));
33627 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33628 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33629 QueryChannelRange_free(this_obj_conv);
33632 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33633 LDKQueryChannelRange this_ptr_conv;
33634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33635 this_ptr_conv.is_owned = false;
33636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33637 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33638 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
33642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33643 LDKQueryChannelRange this_ptr_conv;
33644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33645 this_ptr_conv.is_owned = false;
33646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33647 LDKThirtyTwoBytes val_ref;
33648 CHECK((*env)->GetArrayLength(env, val) == 32);
33649 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33650 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
33653 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
33654 LDKQueryChannelRange this_ptr_conv;
33655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33656 this_ptr_conv.is_owned = false;
33657 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33658 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
33662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33663 LDKQueryChannelRange this_ptr_conv;
33664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33665 this_ptr_conv.is_owned = false;
33666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33667 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
33670 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
33671 LDKQueryChannelRange this_ptr_conv;
33672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33673 this_ptr_conv.is_owned = false;
33674 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33675 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
33679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33680 LDKQueryChannelRange this_ptr_conv;
33681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33682 this_ptr_conv.is_owned = false;
33683 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33684 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
33687 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) {
33688 LDKThirtyTwoBytes chain_hash_arg_ref;
33689 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
33690 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
33691 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
33692 int64_t ret_ref = 0;
33693 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33694 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33695 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33696 ret_ref = (uintptr_t)ret_var.inner;
33697 if (ret_var.is_owned) {
33703 static inline uintptr_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
33704 LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
33705 int64_t ret_ref = 0;
33706 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33707 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33708 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33709 ret_ref = (uintptr_t)ret_var.inner;
33710 if (ret_var.is_owned) {
33715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33716 LDKQueryChannelRange arg_conv;
33717 arg_conv.inner = (void*)(arg & (~1));
33718 arg_conv.is_owned = false;
33719 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33720 int64_t ret_val = QueryChannelRange_clone_ptr(&arg_conv);
33724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33725 LDKQueryChannelRange orig_conv;
33726 orig_conv.inner = (void*)(orig & (~1));
33727 orig_conv.is_owned = false;
33728 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33729 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
33730 int64_t ret_ref = 0;
33731 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33732 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33733 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33734 ret_ref = (uintptr_t)ret_var.inner;
33735 if (ret_var.is_owned) {
33741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33742 LDKReplyChannelRange this_obj_conv;
33743 this_obj_conv.inner = (void*)(this_obj & (~1));
33744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33745 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33746 ReplyChannelRange_free(this_obj_conv);
33749 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33750 LDKReplyChannelRange this_ptr_conv;
33751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33752 this_ptr_conv.is_owned = false;
33753 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33754 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33755 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
33759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33760 LDKReplyChannelRange this_ptr_conv;
33761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33762 this_ptr_conv.is_owned = false;
33763 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33764 LDKThirtyTwoBytes val_ref;
33765 CHECK((*env)->GetArrayLength(env, val) == 32);
33766 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33767 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
33770 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
33771 LDKReplyChannelRange this_ptr_conv;
33772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33773 this_ptr_conv.is_owned = false;
33774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33775 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
33779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33780 LDKReplyChannelRange this_ptr_conv;
33781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33782 this_ptr_conv.is_owned = false;
33783 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33784 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
33787 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
33788 LDKReplyChannelRange this_ptr_conv;
33789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33790 this_ptr_conv.is_owned = false;
33791 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33792 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
33796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
33797 LDKReplyChannelRange this_ptr_conv;
33798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33799 this_ptr_conv.is_owned = false;
33800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33801 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
33804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
33805 LDKReplyChannelRange this_ptr_conv;
33806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33807 this_ptr_conv.is_owned = false;
33808 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33809 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
33813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
33814 LDKReplyChannelRange this_ptr_conv;
33815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33816 this_ptr_conv.is_owned = false;
33817 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33818 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
33821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
33822 LDKReplyChannelRange this_ptr_conv;
33823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33824 this_ptr_conv.is_owned = false;
33825 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33826 LDKCVec_u64Z val_constr;
33827 val_constr.datalen = (*env)->GetArrayLength(env, val);
33828 if (val_constr.datalen > 0)
33829 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33831 val_constr.data = NULL;
33832 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
33833 for (size_t g = 0; g < val_constr.datalen; g++) {
33834 int64_t val_conv_6 = val_vals[g];
33835 val_constr.data[g] = val_conv_6;
33837 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
33838 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
33841 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) {
33842 LDKThirtyTwoBytes chain_hash_arg_ref;
33843 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
33844 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
33845 LDKCVec_u64Z short_channel_ids_arg_constr;
33846 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
33847 if (short_channel_ids_arg_constr.datalen > 0)
33848 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33850 short_channel_ids_arg_constr.data = NULL;
33851 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
33852 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
33853 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
33854 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
33856 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
33857 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
33858 int64_t ret_ref = 0;
33859 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33860 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33862 ret_ref = (uintptr_t)ret_var.inner;
33863 if (ret_var.is_owned) {
33869 static inline uintptr_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
33870 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
33871 int64_t ret_ref = 0;
33872 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33873 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33874 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33875 ret_ref = (uintptr_t)ret_var.inner;
33876 if (ret_var.is_owned) {
33881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33882 LDKReplyChannelRange arg_conv;
33883 arg_conv.inner = (void*)(arg & (~1));
33884 arg_conv.is_owned = false;
33885 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33886 int64_t ret_val = ReplyChannelRange_clone_ptr(&arg_conv);
33890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33891 LDKReplyChannelRange orig_conv;
33892 orig_conv.inner = (void*)(orig & (~1));
33893 orig_conv.is_owned = false;
33894 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33895 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
33896 int64_t ret_ref = 0;
33897 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33898 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33899 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33900 ret_ref = (uintptr_t)ret_var.inner;
33901 if (ret_var.is_owned) {
33907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
33908 LDKQueryShortChannelIds this_obj_conv;
33909 this_obj_conv.inner = (void*)(this_obj & (~1));
33910 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
33911 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33912 QueryShortChannelIds_free(this_obj_conv);
33915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
33916 LDKQueryShortChannelIds this_ptr_conv;
33917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33918 this_ptr_conv.is_owned = false;
33919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33920 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
33921 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
33925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
33926 LDKQueryShortChannelIds this_ptr_conv;
33927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33928 this_ptr_conv.is_owned = false;
33929 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33930 LDKThirtyTwoBytes val_ref;
33931 CHECK((*env)->GetArrayLength(env, val) == 32);
33932 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
33933 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
33936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
33937 LDKQueryShortChannelIds this_ptr_conv;
33938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
33939 this_ptr_conv.is_owned = false;
33940 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33941 LDKCVec_u64Z val_constr;
33942 val_constr.datalen = (*env)->GetArrayLength(env, val);
33943 if (val_constr.datalen > 0)
33944 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33946 val_constr.data = NULL;
33947 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
33948 for (size_t g = 0; g < val_constr.datalen; g++) {
33949 int64_t val_conv_6 = val_vals[g];
33950 val_constr.data[g] = val_conv_6;
33952 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
33953 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
33956 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) {
33957 LDKThirtyTwoBytes chain_hash_arg_ref;
33958 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
33959 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
33960 LDKCVec_u64Z short_channel_ids_arg_constr;
33961 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
33962 if (short_channel_ids_arg_constr.datalen > 0)
33963 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
33965 short_channel_ids_arg_constr.data = NULL;
33966 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
33967 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
33968 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
33969 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
33971 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
33972 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
33973 int64_t ret_ref = 0;
33974 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33975 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33976 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33977 ret_ref = (uintptr_t)ret_var.inner;
33978 if (ret_var.is_owned) {
33984 static inline uintptr_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
33985 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
33986 int64_t ret_ref = 0;
33987 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
33988 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
33989 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33990 ret_ref = (uintptr_t)ret_var.inner;
33991 if (ret_var.is_owned) {
33996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33997 LDKQueryShortChannelIds arg_conv;
33998 arg_conv.inner = (void*)(arg & (~1));
33999 arg_conv.is_owned = false;
34000 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34001 int64_t ret_val = QueryShortChannelIds_clone_ptr(&arg_conv);
34005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34006 LDKQueryShortChannelIds orig_conv;
34007 orig_conv.inner = (void*)(orig & (~1));
34008 orig_conv.is_owned = false;
34009 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34010 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
34011 int64_t ret_ref = 0;
34012 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34013 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34014 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34015 ret_ref = (uintptr_t)ret_var.inner;
34016 if (ret_var.is_owned) {
34022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34023 LDKReplyShortChannelIdsEnd this_obj_conv;
34024 this_obj_conv.inner = (void*)(this_obj & (~1));
34025 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34026 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34027 ReplyShortChannelIdsEnd_free(this_obj_conv);
34030 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34031 LDKReplyShortChannelIdsEnd this_ptr_conv;
34032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34033 this_ptr_conv.is_owned = false;
34034 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34035 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34036 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
34040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34041 LDKReplyShortChannelIdsEnd this_ptr_conv;
34042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34043 this_ptr_conv.is_owned = false;
34044 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34045 LDKThirtyTwoBytes val_ref;
34046 CHECK((*env)->GetArrayLength(env, val) == 32);
34047 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34048 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
34051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
34052 LDKReplyShortChannelIdsEnd this_ptr_conv;
34053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34054 this_ptr_conv.is_owned = false;
34055 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34056 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
34060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
34061 LDKReplyShortChannelIdsEnd this_ptr_conv;
34062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34063 this_ptr_conv.is_owned = false;
34064 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34065 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
34068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
34069 LDKThirtyTwoBytes chain_hash_arg_ref;
34070 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34071 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34072 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
34073 int64_t ret_ref = 0;
34074 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34075 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34076 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34077 ret_ref = (uintptr_t)ret_var.inner;
34078 if (ret_var.is_owned) {
34084 static inline uintptr_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
34085 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
34086 int64_t ret_ref = 0;
34087 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34088 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34089 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34090 ret_ref = (uintptr_t)ret_var.inner;
34091 if (ret_var.is_owned) {
34096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34097 LDKReplyShortChannelIdsEnd arg_conv;
34098 arg_conv.inner = (void*)(arg & (~1));
34099 arg_conv.is_owned = false;
34100 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34101 int64_t ret_val = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
34105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34106 LDKReplyShortChannelIdsEnd orig_conv;
34107 orig_conv.inner = (void*)(orig & (~1));
34108 orig_conv.is_owned = false;
34109 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34110 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
34111 int64_t ret_ref = 0;
34112 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34113 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34114 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34115 ret_ref = (uintptr_t)ret_var.inner;
34116 if (ret_var.is_owned) {
34122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34123 LDKGossipTimestampFilter this_obj_conv;
34124 this_obj_conv.inner = (void*)(this_obj & (~1));
34125 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34127 GossipTimestampFilter_free(this_obj_conv);
34130 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
34131 LDKGossipTimestampFilter this_ptr_conv;
34132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34133 this_ptr_conv.is_owned = false;
34134 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34135 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
34136 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
34140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
34141 LDKGossipTimestampFilter this_ptr_conv;
34142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34143 this_ptr_conv.is_owned = false;
34144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34145 LDKThirtyTwoBytes val_ref;
34146 CHECK((*env)->GetArrayLength(env, val) == 32);
34147 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
34148 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
34151 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
34152 LDKGossipTimestampFilter this_ptr_conv;
34153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34154 this_ptr_conv.is_owned = false;
34155 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34156 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
34160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34161 LDKGossipTimestampFilter this_ptr_conv;
34162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34163 this_ptr_conv.is_owned = false;
34164 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34165 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
34168 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
34169 LDKGossipTimestampFilter this_ptr_conv;
34170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34171 this_ptr_conv.is_owned = false;
34172 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34173 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
34177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
34178 LDKGossipTimestampFilter this_ptr_conv;
34179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34180 this_ptr_conv.is_owned = false;
34181 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34182 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
34185 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) {
34186 LDKThirtyTwoBytes chain_hash_arg_ref;
34187 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
34188 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
34189 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
34190 int64_t ret_ref = 0;
34191 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34192 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34193 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34194 ret_ref = (uintptr_t)ret_var.inner;
34195 if (ret_var.is_owned) {
34201 static inline uintptr_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
34202 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
34203 int64_t ret_ref = 0;
34204 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34205 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34206 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34207 ret_ref = (uintptr_t)ret_var.inner;
34208 if (ret_var.is_owned) {
34213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34214 LDKGossipTimestampFilter arg_conv;
34215 arg_conv.inner = (void*)(arg & (~1));
34216 arg_conv.is_owned = false;
34217 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34218 int64_t ret_val = GossipTimestampFilter_clone_ptr(&arg_conv);
34222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34223 LDKGossipTimestampFilter orig_conv;
34224 orig_conv.inner = (void*)(orig & (~1));
34225 orig_conv.is_owned = false;
34226 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34227 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
34228 int64_t ret_ref = 0;
34229 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34230 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34231 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34232 ret_ref = (uintptr_t)ret_var.inner;
34233 if (ret_var.is_owned) {
34239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34240 if ((this_ptr & 1) != 0) return;
34241 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34242 CHECK_ACCESS(this_ptr_ptr);
34243 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
34244 FREE((void*)this_ptr);
34245 ErrorAction_free(this_ptr_conv);
34248 static inline uintptr_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
34249 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34250 *ret_copy = ErrorAction_clone(arg);
34251 int64_t ret_ref = (uintptr_t)ret_copy;
34254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34255 LDKErrorAction* arg_conv = (LDKErrorAction*)arg;
34256 int64_t ret_val = ErrorAction_clone_ptr(arg_conv);
34260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34261 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
34262 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34263 *ret_copy = ErrorAction_clone(orig_conv);
34264 int64_t ret_ref = (uintptr_t)ret_copy;
34268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
34269 LDKErrorMessage msg_conv;
34270 msg_conv.inner = (void*)(msg & (~1));
34271 msg_conv.is_owned = (msg & 1) || (msg == 0);
34272 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34273 msg_conv = ErrorMessage_clone(&msg_conv);
34274 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34275 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
34276 int64_t ret_ref = (uintptr_t)ret_copy;
34280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
34281 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34282 *ret_copy = ErrorAction_ignore_error();
34283 int64_t ret_ref = (uintptr_t)ret_copy;
34287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
34288 LDKLevel a_conv = LDKLevel_from_java(env, a);
34289 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34290 *ret_copy = ErrorAction_ignore_and_log(a_conv);
34291 int64_t ret_ref = (uintptr_t)ret_copy;
34295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
34296 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34297 *ret_copy = ErrorAction_ignore_duplicate_gossip();
34298 int64_t ret_ref = (uintptr_t)ret_copy;
34302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
34303 LDKErrorMessage msg_conv;
34304 msg_conv.inner = (void*)(msg & (~1));
34305 msg_conv.is_owned = (msg & 1) || (msg == 0);
34306 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34307 msg_conv = ErrorMessage_clone(&msg_conv);
34308 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34309 *ret_copy = ErrorAction_send_error_message(msg_conv);
34310 int64_t ret_ref = (uintptr_t)ret_copy;
34314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
34315 LDKWarningMessage msg_conv;
34316 msg_conv.inner = (void*)(msg & (~1));
34317 msg_conv.is_owned = (msg & 1) || (msg == 0);
34318 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
34319 msg_conv = WarningMessage_clone(&msg_conv);
34320 LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
34321 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34322 *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
34323 int64_t ret_ref = (uintptr_t)ret_copy;
34327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34328 LDKLightningError this_obj_conv;
34329 this_obj_conv.inner = (void*)(this_obj & (~1));
34330 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34332 LightningError_free(this_obj_conv);
34335 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
34336 LDKLightningError this_ptr_conv;
34337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34338 this_ptr_conv.is_owned = false;
34339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34340 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
34341 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
34346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
34347 LDKLightningError this_ptr_conv;
34348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34349 this_ptr_conv.is_owned = false;
34350 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34351 LDKStr val_conv = java_to_owned_str(env, val);
34352 LightningError_set_err(&this_ptr_conv, val_conv);
34355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
34356 LDKLightningError this_ptr_conv;
34357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34358 this_ptr_conv.is_owned = false;
34359 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34360 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
34361 *ret_copy = LightningError_get_action(&this_ptr_conv);
34362 int64_t ret_ref = (uintptr_t)ret_copy;
34366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34367 LDKLightningError this_ptr_conv;
34368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34369 this_ptr_conv.is_owned = false;
34370 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34371 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
34372 CHECK_ACCESS(val_ptr);
34373 LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
34374 val_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)val) & ~1));
34375 LightningError_set_action(&this_ptr_conv, val_conv);
34378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
34379 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
34380 void* action_arg_ptr = (void*)(((uintptr_t)action_arg) & ~1);
34381 CHECK_ACCESS(action_arg_ptr);
34382 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
34383 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uintptr_t)action_arg) & ~1));
34384 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
34385 int64_t ret_ref = 0;
34386 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34387 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34388 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34389 ret_ref = (uintptr_t)ret_var.inner;
34390 if (ret_var.is_owned) {
34396 static inline uintptr_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
34397 LDKLightningError ret_var = LightningError_clone(arg);
34398 int64_t ret_ref = 0;
34399 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34400 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34401 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34402 ret_ref = (uintptr_t)ret_var.inner;
34403 if (ret_var.is_owned) {
34408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34409 LDKLightningError arg_conv;
34410 arg_conv.inner = (void*)(arg & (~1));
34411 arg_conv.is_owned = false;
34412 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34413 int64_t ret_val = LightningError_clone_ptr(&arg_conv);
34417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34418 LDKLightningError orig_conv;
34419 orig_conv.inner = (void*)(orig & (~1));
34420 orig_conv.is_owned = false;
34421 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34422 LDKLightningError ret_var = LightningError_clone(&orig_conv);
34423 int64_t ret_ref = 0;
34424 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34425 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34426 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34427 ret_ref = (uintptr_t)ret_var.inner;
34428 if (ret_var.is_owned) {
34434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
34435 LDKCommitmentUpdate this_obj_conv;
34436 this_obj_conv.inner = (void*)(this_obj & (~1));
34437 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
34438 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34439 CommitmentUpdate_free(this_obj_conv);
34442 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34443 LDKCommitmentUpdate this_ptr_conv;
34444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34445 this_ptr_conv.is_owned = false;
34446 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34447 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
34448 int64_tArray ret_arr = NULL;
34449 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34450 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34451 for (size_t p = 0; p < ret_var.datalen; p++) {
34452 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
34453 int64_t ret_conv_15_ref = 0;
34454 CHECK((((uintptr_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34455 CHECK((((uintptr_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34456 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
34457 ret_conv_15_ref = (uintptr_t)ret_conv_15_var.inner;
34458 if (ret_conv_15_var.is_owned) {
34459 ret_conv_15_ref |= 1;
34461 ret_arr_ptr[p] = ret_conv_15_ref;
34463 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34464 FREE(ret_var.data);
34468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34469 LDKCommitmentUpdate this_ptr_conv;
34470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34471 this_ptr_conv.is_owned = false;
34472 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34473 LDKCVec_UpdateAddHTLCZ val_constr;
34474 val_constr.datalen = (*env)->GetArrayLength(env, val);
34475 if (val_constr.datalen > 0)
34476 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
34478 val_constr.data = NULL;
34479 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34480 for (size_t p = 0; p < val_constr.datalen; p++) {
34481 int64_t val_conv_15 = val_vals[p];
34482 LDKUpdateAddHTLC val_conv_15_conv;
34483 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
34484 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
34485 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
34486 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
34487 val_constr.data[p] = val_conv_15_conv;
34489 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34490 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
34493 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34494 LDKCommitmentUpdate this_ptr_conv;
34495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34496 this_ptr_conv.is_owned = false;
34497 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34498 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
34499 int64_tArray ret_arr = NULL;
34500 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34501 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34502 for (size_t t = 0; t < ret_var.datalen; t++) {
34503 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
34504 int64_t ret_conv_19_ref = 0;
34505 CHECK((((uintptr_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34506 CHECK((((uintptr_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34507 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
34508 ret_conv_19_ref = (uintptr_t)ret_conv_19_var.inner;
34509 if (ret_conv_19_var.is_owned) {
34510 ret_conv_19_ref |= 1;
34512 ret_arr_ptr[t] = ret_conv_19_ref;
34514 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34515 FREE(ret_var.data);
34519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34520 LDKCommitmentUpdate this_ptr_conv;
34521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34522 this_ptr_conv.is_owned = false;
34523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34524 LDKCVec_UpdateFulfillHTLCZ val_constr;
34525 val_constr.datalen = (*env)->GetArrayLength(env, val);
34526 if (val_constr.datalen > 0)
34527 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
34529 val_constr.data = NULL;
34530 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34531 for (size_t t = 0; t < val_constr.datalen; t++) {
34532 int64_t val_conv_19 = val_vals[t];
34533 LDKUpdateFulfillHTLC val_conv_19_conv;
34534 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
34535 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
34536 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
34537 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
34538 val_constr.data[t] = val_conv_19_conv;
34540 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34541 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
34544 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34545 LDKCommitmentUpdate this_ptr_conv;
34546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34547 this_ptr_conv.is_owned = false;
34548 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34549 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
34550 int64_tArray ret_arr = NULL;
34551 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34552 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34553 for (size_t q = 0; q < ret_var.datalen; q++) {
34554 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
34555 int64_t ret_conv_16_ref = 0;
34556 CHECK((((uintptr_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34557 CHECK((((uintptr_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34558 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
34559 ret_conv_16_ref = (uintptr_t)ret_conv_16_var.inner;
34560 if (ret_conv_16_var.is_owned) {
34561 ret_conv_16_ref |= 1;
34563 ret_arr_ptr[q] = ret_conv_16_ref;
34565 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34566 FREE(ret_var.data);
34570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
34571 LDKCommitmentUpdate this_ptr_conv;
34572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34573 this_ptr_conv.is_owned = false;
34574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34575 LDKCVec_UpdateFailHTLCZ val_constr;
34576 val_constr.datalen = (*env)->GetArrayLength(env, val);
34577 if (val_constr.datalen > 0)
34578 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
34580 val_constr.data = NULL;
34581 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34582 for (size_t q = 0; q < val_constr.datalen; q++) {
34583 int64_t val_conv_16 = val_vals[q];
34584 LDKUpdateFailHTLC val_conv_16_conv;
34585 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
34586 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
34587 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
34588 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
34589 val_constr.data[q] = val_conv_16_conv;
34591 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34592 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
34595 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
34596 LDKCommitmentUpdate this_ptr_conv;
34597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34598 this_ptr_conv.is_owned = false;
34599 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34600 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
34601 int64_tArray ret_arr = NULL;
34602 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
34603 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
34604 for (size_t z = 0; z < ret_var.datalen; z++) {
34605 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
34606 int64_t ret_conv_25_ref = 0;
34607 CHECK((((uintptr_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34608 CHECK((((uintptr_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34609 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
34610 ret_conv_25_ref = (uintptr_t)ret_conv_25_var.inner;
34611 if (ret_conv_25_var.is_owned) {
34612 ret_conv_25_ref |= 1;
34614 ret_arr_ptr[z] = ret_conv_25_ref;
34616 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
34617 FREE(ret_var.data);
34621 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) {
34622 LDKCommitmentUpdate this_ptr_conv;
34623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34624 this_ptr_conv.is_owned = false;
34625 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34626 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
34627 val_constr.datalen = (*env)->GetArrayLength(env, val);
34628 if (val_constr.datalen > 0)
34629 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
34631 val_constr.data = NULL;
34632 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
34633 for (size_t z = 0; z < val_constr.datalen; z++) {
34634 int64_t val_conv_25 = val_vals[z];
34635 LDKUpdateFailMalformedHTLC val_conv_25_conv;
34636 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
34637 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
34638 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
34639 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
34640 val_constr.data[z] = val_conv_25_conv;
34642 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
34643 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
34646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
34647 LDKCommitmentUpdate this_ptr_conv;
34648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34649 this_ptr_conv.is_owned = false;
34650 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34651 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
34652 int64_t ret_ref = 0;
34653 if ((uintptr_t)ret_var.inner > 4096) {
34654 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34655 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34656 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34657 ret_ref = (uintptr_t)ret_var.inner;
34658 if (ret_var.is_owned) {
34665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34666 LDKCommitmentUpdate this_ptr_conv;
34667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34668 this_ptr_conv.is_owned = false;
34669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34670 LDKUpdateFee val_conv;
34671 val_conv.inner = (void*)(val & (~1));
34672 val_conv.is_owned = (val & 1) || (val == 0);
34673 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34674 val_conv = UpdateFee_clone(&val_conv);
34675 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
34678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
34679 LDKCommitmentUpdate this_ptr_conv;
34680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34681 this_ptr_conv.is_owned = false;
34682 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34683 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
34684 int64_t ret_ref = 0;
34685 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34686 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34687 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34688 ret_ref = (uintptr_t)ret_var.inner;
34689 if (ret_var.is_owned) {
34695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
34696 LDKCommitmentUpdate this_ptr_conv;
34697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
34698 this_ptr_conv.is_owned = false;
34699 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34700 LDKCommitmentSigned val_conv;
34701 val_conv.inner = (void*)(val & (~1));
34702 val_conv.is_owned = (val & 1) || (val == 0);
34703 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34704 val_conv = CommitmentSigned_clone(&val_conv);
34705 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
34708 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) {
34709 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
34710 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
34711 if (update_add_htlcs_arg_constr.datalen > 0)
34712 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
34714 update_add_htlcs_arg_constr.data = NULL;
34715 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
34716 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
34717 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
34718 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
34719 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
34720 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
34721 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
34722 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
34723 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
34725 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
34726 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
34727 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
34728 if (update_fulfill_htlcs_arg_constr.datalen > 0)
34729 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
34731 update_fulfill_htlcs_arg_constr.data = NULL;
34732 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
34733 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
34734 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
34735 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
34736 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
34737 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
34738 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
34739 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
34740 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
34742 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
34743 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
34744 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
34745 if (update_fail_htlcs_arg_constr.datalen > 0)
34746 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
34748 update_fail_htlcs_arg_constr.data = NULL;
34749 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
34750 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
34751 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
34752 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
34753 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
34754 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
34755 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
34756 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
34757 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
34759 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
34760 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
34761 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
34762 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
34763 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
34765 update_fail_malformed_htlcs_arg_constr.data = NULL;
34766 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
34767 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
34768 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
34769 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
34770 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
34771 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);
34772 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
34773 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
34774 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
34776 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
34777 LDKUpdateFee update_fee_arg_conv;
34778 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
34779 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
34780 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
34781 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
34782 LDKCommitmentSigned commitment_signed_arg_conv;
34783 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
34784 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
34785 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
34786 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
34787 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);
34788 int64_t ret_ref = 0;
34789 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34790 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34791 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34792 ret_ref = (uintptr_t)ret_var.inner;
34793 if (ret_var.is_owned) {
34799 static inline uintptr_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
34800 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
34801 int64_t ret_ref = 0;
34802 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34803 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34804 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34805 ret_ref = (uintptr_t)ret_var.inner;
34806 if (ret_var.is_owned) {
34811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34812 LDKCommitmentUpdate arg_conv;
34813 arg_conv.inner = (void*)(arg & (~1));
34814 arg_conv.is_owned = false;
34815 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34816 int64_t ret_val = CommitmentUpdate_clone_ptr(&arg_conv);
34820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34821 LDKCommitmentUpdate orig_conv;
34822 orig_conv.inner = (void*)(orig & (~1));
34823 orig_conv.is_owned = false;
34824 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34825 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
34826 int64_t ret_ref = 0;
34827 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
34828 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
34829 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34830 ret_ref = (uintptr_t)ret_var.inner;
34831 if (ret_var.is_owned) {
34837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34838 if ((this_ptr & 1) != 0) return;
34839 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34840 CHECK_ACCESS(this_ptr_ptr);
34841 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
34842 FREE((void*)this_ptr);
34843 ChannelMessageHandler_free(this_ptr_conv);
34846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
34847 if ((this_ptr & 1) != 0) return;
34848 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
34849 CHECK_ACCESS(this_ptr_ptr);
34850 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
34851 FREE((void*)this_ptr);
34852 RoutingMessageHandler_free(this_ptr_conv);
34855 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
34856 LDKAcceptChannel obj_conv;
34857 obj_conv.inner = (void*)(obj & (~1));
34858 obj_conv.is_owned = false;
34859 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34860 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
34861 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34862 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34863 CVec_u8Z_free(ret_var);
34867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34868 LDKu8slice ser_ref;
34869 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34870 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34871 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
34872 *ret_conv = AcceptChannel_read(ser_ref);
34873 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34874 return (int64_t)ret_conv;
34877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
34878 LDKAnnouncementSignatures obj_conv;
34879 obj_conv.inner = (void*)(obj & (~1));
34880 obj_conv.is_owned = false;
34881 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34882 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
34883 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34884 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34885 CVec_u8Z_free(ret_var);
34889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34890 LDKu8slice ser_ref;
34891 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34892 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34893 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34894 *ret_conv = AnnouncementSignatures_read(ser_ref);
34895 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34896 return (int64_t)ret_conv;
34899 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
34900 LDKChannelReestablish obj_conv;
34901 obj_conv.inner = (void*)(obj & (~1));
34902 obj_conv.is_owned = false;
34903 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34904 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
34905 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34906 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34907 CVec_u8Z_free(ret_var);
34911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34912 LDKu8slice ser_ref;
34913 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34914 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34915 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34916 *ret_conv = ChannelReestablish_read(ser_ref);
34917 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34918 return (int64_t)ret_conv;
34921 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
34922 LDKClosingSigned obj_conv;
34923 obj_conv.inner = (void*)(obj & (~1));
34924 obj_conv.is_owned = false;
34925 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34926 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
34927 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34928 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34929 CVec_u8Z_free(ret_var);
34933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34934 LDKu8slice ser_ref;
34935 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34936 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34937 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34938 *ret_conv = ClosingSigned_read(ser_ref);
34939 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34940 return (int64_t)ret_conv;
34943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
34944 LDKClosingSignedFeeRange obj_conv;
34945 obj_conv.inner = (void*)(obj & (~1));
34946 obj_conv.is_owned = false;
34947 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34948 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
34949 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34950 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34951 CVec_u8Z_free(ret_var);
34955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34956 LDKu8slice ser_ref;
34957 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34958 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34959 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34960 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
34961 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34962 return (int64_t)ret_conv;
34965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
34966 LDKCommitmentSigned obj_conv;
34967 obj_conv.inner = (void*)(obj & (~1));
34968 obj_conv.is_owned = false;
34969 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34970 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
34971 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34972 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34973 CVec_u8Z_free(ret_var);
34977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
34978 LDKu8slice ser_ref;
34979 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
34980 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
34981 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34982 *ret_conv = CommitmentSigned_read(ser_ref);
34983 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
34984 return (int64_t)ret_conv;
34987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
34988 LDKFundingCreated obj_conv;
34989 obj_conv.inner = (void*)(obj & (~1));
34990 obj_conv.is_owned = false;
34991 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34992 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
34993 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
34994 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
34995 CVec_u8Z_free(ret_var);
34999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35000 LDKu8slice ser_ref;
35001 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35002 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35003 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
35004 *ret_conv = FundingCreated_read(ser_ref);
35005 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35006 return (int64_t)ret_conv;
35009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
35010 LDKFundingSigned obj_conv;
35011 obj_conv.inner = (void*)(obj & (~1));
35012 obj_conv.is_owned = false;
35013 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35014 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
35015 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35016 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35017 CVec_u8Z_free(ret_var);
35021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35022 LDKu8slice ser_ref;
35023 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35024 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35025 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
35026 *ret_conv = FundingSigned_read(ser_ref);
35027 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35028 return (int64_t)ret_conv;
35031 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
35032 LDKFundingLocked obj_conv;
35033 obj_conv.inner = (void*)(obj & (~1));
35034 obj_conv.is_owned = false;
35035 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35036 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
35037 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35038 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35039 CVec_u8Z_free(ret_var);
35043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35044 LDKu8slice ser_ref;
35045 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35046 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35047 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
35048 *ret_conv = FundingLocked_read(ser_ref);
35049 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35050 return (int64_t)ret_conv;
35053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
35055 obj_conv.inner = (void*)(obj & (~1));
35056 obj_conv.is_owned = false;
35057 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35058 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
35059 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35060 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35061 CVec_u8Z_free(ret_var);
35065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35066 LDKu8slice ser_ref;
35067 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35068 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35069 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
35070 *ret_conv = Init_read(ser_ref);
35071 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35072 return (int64_t)ret_conv;
35075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
35076 LDKOpenChannel obj_conv;
35077 obj_conv.inner = (void*)(obj & (~1));
35078 obj_conv.is_owned = false;
35079 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35080 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
35081 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35082 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35083 CVec_u8Z_free(ret_var);
35087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35088 LDKu8slice ser_ref;
35089 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35090 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35091 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
35092 *ret_conv = OpenChannel_read(ser_ref);
35093 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35094 return (int64_t)ret_conv;
35097 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
35098 LDKRevokeAndACK obj_conv;
35099 obj_conv.inner = (void*)(obj & (~1));
35100 obj_conv.is_owned = false;
35101 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35102 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
35103 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35104 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35105 CVec_u8Z_free(ret_var);
35109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35110 LDKu8slice ser_ref;
35111 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35112 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35113 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
35114 *ret_conv = RevokeAndACK_read(ser_ref);
35115 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35116 return (int64_t)ret_conv;
35119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
35120 LDKShutdown obj_conv;
35121 obj_conv.inner = (void*)(obj & (~1));
35122 obj_conv.is_owned = false;
35123 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35124 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
35125 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35126 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35127 CVec_u8Z_free(ret_var);
35131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35132 LDKu8slice ser_ref;
35133 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35134 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35135 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35136 *ret_conv = Shutdown_read(ser_ref);
35137 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35138 return (int64_t)ret_conv;
35141 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35142 LDKUpdateFailHTLC obj_conv;
35143 obj_conv.inner = (void*)(obj & (~1));
35144 obj_conv.is_owned = false;
35145 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35146 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
35147 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35148 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35149 CVec_u8Z_free(ret_var);
35153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35154 LDKu8slice ser_ref;
35155 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35156 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35157 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35158 *ret_conv = UpdateFailHTLC_read(ser_ref);
35159 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35160 return (int64_t)ret_conv;
35163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35164 LDKUpdateFailMalformedHTLC obj_conv;
35165 obj_conv.inner = (void*)(obj & (~1));
35166 obj_conv.is_owned = false;
35167 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35168 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
35169 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35170 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35171 CVec_u8Z_free(ret_var);
35175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35176 LDKu8slice ser_ref;
35177 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35178 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35179 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35180 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
35181 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35182 return (int64_t)ret_conv;
35185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
35186 LDKUpdateFee obj_conv;
35187 obj_conv.inner = (void*)(obj & (~1));
35188 obj_conv.is_owned = false;
35189 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35190 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
35191 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35192 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35193 CVec_u8Z_free(ret_var);
35197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35198 LDKu8slice ser_ref;
35199 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35200 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35201 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35202 *ret_conv = UpdateFee_read(ser_ref);
35203 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35204 return (int64_t)ret_conv;
35207 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35208 LDKUpdateFulfillHTLC obj_conv;
35209 obj_conv.inner = (void*)(obj & (~1));
35210 obj_conv.is_owned = false;
35211 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35212 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
35213 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35214 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35215 CVec_u8Z_free(ret_var);
35219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35220 LDKu8slice ser_ref;
35221 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35222 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35223 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35224 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
35225 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35226 return (int64_t)ret_conv;
35229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
35230 LDKUpdateAddHTLC obj_conv;
35231 obj_conv.inner = (void*)(obj & (~1));
35232 obj_conv.is_owned = false;
35233 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35234 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
35235 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35236 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35237 CVec_u8Z_free(ret_var);
35241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35242 LDKu8slice ser_ref;
35243 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35244 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35245 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35246 *ret_conv = UpdateAddHTLC_read(ser_ref);
35247 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35248 return (int64_t)ret_conv;
35251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
35253 obj_conv.inner = (void*)(obj & (~1));
35254 obj_conv.is_owned = false;
35255 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35256 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
35257 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35258 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35259 CVec_u8Z_free(ret_var);
35263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35264 LDKu8slice ser_ref;
35265 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35266 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35267 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35268 *ret_conv = Ping_read(ser_ref);
35269 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35270 return (int64_t)ret_conv;
35273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
35275 obj_conv.inner = (void*)(obj & (~1));
35276 obj_conv.is_owned = false;
35277 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35278 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
35279 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35280 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35281 CVec_u8Z_free(ret_var);
35285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35286 LDKu8slice ser_ref;
35287 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35288 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35289 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35290 *ret_conv = Pong_read(ser_ref);
35291 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35292 return (int64_t)ret_conv;
35295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35296 LDKUnsignedChannelAnnouncement obj_conv;
35297 obj_conv.inner = (void*)(obj & (~1));
35298 obj_conv.is_owned = false;
35299 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35300 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
35301 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35302 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35303 CVec_u8Z_free(ret_var);
35307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35308 LDKu8slice ser_ref;
35309 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35310 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35311 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35312 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
35313 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35314 return (int64_t)ret_conv;
35317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35318 LDKChannelAnnouncement obj_conv;
35319 obj_conv.inner = (void*)(obj & (~1));
35320 obj_conv.is_owned = false;
35321 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35322 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
35323 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35324 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35325 CVec_u8Z_free(ret_var);
35329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35330 LDKu8slice ser_ref;
35331 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35332 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35333 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35334 *ret_conv = ChannelAnnouncement_read(ser_ref);
35335 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35336 return (int64_t)ret_conv;
35339 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35340 LDKUnsignedChannelUpdate obj_conv;
35341 obj_conv.inner = (void*)(obj & (~1));
35342 obj_conv.is_owned = false;
35343 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35344 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
35345 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35346 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35347 CVec_u8Z_free(ret_var);
35351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35352 LDKu8slice ser_ref;
35353 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35354 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35355 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35356 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
35357 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35358 return (int64_t)ret_conv;
35361 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
35362 LDKChannelUpdate obj_conv;
35363 obj_conv.inner = (void*)(obj & (~1));
35364 obj_conv.is_owned = false;
35365 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35366 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
35367 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35368 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35369 CVec_u8Z_free(ret_var);
35373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35374 LDKu8slice ser_ref;
35375 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35376 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35377 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35378 *ret_conv = ChannelUpdate_read(ser_ref);
35379 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35380 return (int64_t)ret_conv;
35383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
35384 LDKErrorMessage obj_conv;
35385 obj_conv.inner = (void*)(obj & (~1));
35386 obj_conv.is_owned = false;
35387 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35388 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
35389 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35390 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35391 CVec_u8Z_free(ret_var);
35395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35396 LDKu8slice ser_ref;
35397 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35398 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35399 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35400 *ret_conv = ErrorMessage_read(ser_ref);
35401 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35402 return (int64_t)ret_conv;
35405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
35406 LDKWarningMessage obj_conv;
35407 obj_conv.inner = (void*)(obj & (~1));
35408 obj_conv.is_owned = false;
35409 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35410 LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
35411 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35412 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35413 CVec_u8Z_free(ret_var);
35417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35418 LDKu8slice ser_ref;
35419 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35420 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35421 LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35422 *ret_conv = WarningMessage_read(ser_ref);
35423 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35424 return (int64_t)ret_conv;
35427 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35428 LDKUnsignedNodeAnnouncement obj_conv;
35429 obj_conv.inner = (void*)(obj & (~1));
35430 obj_conv.is_owned = false;
35431 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35432 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
35433 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35434 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35435 CVec_u8Z_free(ret_var);
35439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35440 LDKu8slice ser_ref;
35441 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35442 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35443 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35444 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
35445 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35446 return (int64_t)ret_conv;
35449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
35450 LDKNodeAnnouncement obj_conv;
35451 obj_conv.inner = (void*)(obj & (~1));
35452 obj_conv.is_owned = false;
35453 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35454 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
35455 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35456 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35457 CVec_u8Z_free(ret_var);
35461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35462 LDKu8slice ser_ref;
35463 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35464 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35465 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
35466 *ret_conv = NodeAnnouncement_read(ser_ref);
35467 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35468 return (int64_t)ret_conv;
35471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35472 LDKu8slice ser_ref;
35473 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35474 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35475 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
35476 *ret_conv = QueryShortChannelIds_read(ser_ref);
35477 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35478 return (int64_t)ret_conv;
35481 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
35482 LDKQueryShortChannelIds obj_conv;
35483 obj_conv.inner = (void*)(obj & (~1));
35484 obj_conv.is_owned = false;
35485 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35486 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
35487 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35488 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35489 CVec_u8Z_free(ret_var);
35493 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
35494 LDKReplyShortChannelIdsEnd obj_conv;
35495 obj_conv.inner = (void*)(obj & (~1));
35496 obj_conv.is_owned = false;
35497 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35498 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
35499 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35500 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35501 CVec_u8Z_free(ret_var);
35505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35506 LDKu8slice ser_ref;
35507 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35508 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35509 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
35510 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
35511 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35512 return (int64_t)ret_conv;
35515 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
35516 LDKQueryChannelRange this_arg_conv;
35517 this_arg_conv.inner = (void*)(this_arg & (~1));
35518 this_arg_conv.is_owned = false;
35519 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35520 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
35524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
35525 LDKQueryChannelRange obj_conv;
35526 obj_conv.inner = (void*)(obj & (~1));
35527 obj_conv.is_owned = false;
35528 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35529 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
35530 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35531 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35532 CVec_u8Z_free(ret_var);
35536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35537 LDKu8slice ser_ref;
35538 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35539 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35540 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
35541 *ret_conv = QueryChannelRange_read(ser_ref);
35542 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35543 return (int64_t)ret_conv;
35546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35547 LDKu8slice ser_ref;
35548 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35549 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35550 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
35551 *ret_conv = ReplyChannelRange_read(ser_ref);
35552 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35553 return (int64_t)ret_conv;
35556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
35557 LDKReplyChannelRange obj_conv;
35558 obj_conv.inner = (void*)(obj & (~1));
35559 obj_conv.is_owned = false;
35560 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35561 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
35562 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35563 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35564 CVec_u8Z_free(ret_var);
35568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
35569 LDKGossipTimestampFilter obj_conv;
35570 obj_conv.inner = (void*)(obj & (~1));
35571 obj_conv.is_owned = false;
35572 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35573 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
35574 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
35575 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
35576 CVec_u8Z_free(ret_var);
35580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
35581 LDKu8slice ser_ref;
35582 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
35583 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
35584 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
35585 *ret_conv = GossipTimestampFilter_read(ser_ref);
35586 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
35587 return (int64_t)ret_conv;
35590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35591 if ((this_ptr & 1) != 0) return;
35592 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35593 CHECK_ACCESS(this_ptr_ptr);
35594 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
35595 FREE((void*)this_ptr);
35596 CustomMessageHandler_free(this_ptr_conv);
35599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35600 LDKIgnoringMessageHandler this_obj_conv;
35601 this_obj_conv.inner = (void*)(this_obj & (~1));
35602 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35603 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35604 IgnoringMessageHandler_free(this_obj_conv);
35607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
35608 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
35609 int64_t ret_ref = 0;
35610 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35611 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35613 ret_ref = (uintptr_t)ret_var.inner;
35614 if (ret_var.is_owned) {
35620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
35621 LDKIgnoringMessageHandler this_arg_conv;
35622 this_arg_conv.inner = (void*)(this_arg & (~1));
35623 this_arg_conv.is_owned = false;
35624 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35625 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35626 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
35627 return (int64_t)ret_ret;
35630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
35631 LDKIgnoringMessageHandler this_arg_conv;
35632 this_arg_conv.inner = (void*)(this_arg & (~1));
35633 this_arg_conv.is_owned = false;
35634 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35635 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
35636 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
35637 return (int64_t)ret_ret;
35640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
35641 LDKIgnoringMessageHandler this_arg_conv;
35642 this_arg_conv.inner = (void*)(this_arg & (~1));
35643 this_arg_conv.is_owned = false;
35644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35645 LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
35646 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
35647 return (int64_t)ret_ret;
35650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
35651 LDKIgnoringMessageHandler this_arg_conv;
35652 this_arg_conv.inner = (void*)(this_arg & (~1));
35653 this_arg_conv.is_owned = false;
35654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35655 LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
35656 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
35657 return (int64_t)ret_ret;
35660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35661 LDKErroringMessageHandler this_obj_conv;
35662 this_obj_conv.inner = (void*)(this_obj & (~1));
35663 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35665 ErroringMessageHandler_free(this_obj_conv);
35668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
35669 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
35670 int64_t ret_ref = 0;
35671 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35672 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35673 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35674 ret_ref = (uintptr_t)ret_var.inner;
35675 if (ret_var.is_owned) {
35681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
35682 LDKErroringMessageHandler this_arg_conv;
35683 this_arg_conv.inner = (void*)(this_arg & (~1));
35684 this_arg_conv.is_owned = false;
35685 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35686 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
35687 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
35688 return (int64_t)ret_ret;
35691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
35692 LDKErroringMessageHandler this_arg_conv;
35693 this_arg_conv.inner = (void*)(this_arg & (~1));
35694 this_arg_conv.is_owned = false;
35695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35696 LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
35697 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
35698 return (int64_t)ret_ret;
35701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35702 LDKMessageHandler this_obj_conv;
35703 this_obj_conv.inner = (void*)(this_obj & (~1));
35704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35706 MessageHandler_free(this_obj_conv);
35709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
35710 LDKMessageHandler this_ptr_conv;
35711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35712 this_ptr_conv.is_owned = false;
35713 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35714 // WARNING: This object doesn't live past this scope, needs clone!
35715 int64_t ret_ret = ((uintptr_t)MessageHandler_get_chan_handler(&this_ptr_conv)) | 1;
35719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35720 LDKMessageHandler this_ptr_conv;
35721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35722 this_ptr_conv.is_owned = false;
35723 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35724 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
35725 CHECK_ACCESS(val_ptr);
35726 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
35727 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
35728 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35729 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
35731 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
35734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
35735 LDKMessageHandler this_ptr_conv;
35736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35737 this_ptr_conv.is_owned = false;
35738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35739 // WARNING: This object doesn't live past this scope, needs clone!
35740 int64_t ret_ret = ((uintptr_t)MessageHandler_get_route_handler(&this_ptr_conv)) | 1;
35744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
35745 LDKMessageHandler this_ptr_conv;
35746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35747 this_ptr_conv.is_owned = false;
35748 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35749 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
35750 CHECK_ACCESS(val_ptr);
35751 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
35752 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
35753 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35754 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
35756 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
35759 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) {
35760 void* chan_handler_arg_ptr = (void*)(((uintptr_t)chan_handler_arg) & ~1);
35761 CHECK_ACCESS(chan_handler_arg_ptr);
35762 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
35763 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
35764 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35765 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
35767 void* route_handler_arg_ptr = (void*)(((uintptr_t)route_handler_arg) & ~1);
35768 CHECK_ACCESS(route_handler_arg_ptr);
35769 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
35770 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
35771 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35772 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
35774 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
35775 int64_t ret_ref = 0;
35776 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35777 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35778 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35779 ret_ref = (uintptr_t)ret_var.inner;
35780 if (ret_var.is_owned) {
35786 static inline uintptr_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
35787 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
35788 *ret_ret = SocketDescriptor_clone(arg);
35789 return (int64_t)ret_ret;
35791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35792 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
35793 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
35794 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
35795 int64_t ret_val = SocketDescriptor_clone_ptr(arg_conv);
35799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35800 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
35801 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
35802 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
35803 LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
35804 *ret_ret = SocketDescriptor_clone(orig_conv);
35805 return (int64_t)ret_ret;
35808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
35809 if ((this_ptr & 1) != 0) return;
35810 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
35811 CHECK_ACCESS(this_ptr_ptr);
35812 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
35813 FREE((void*)this_ptr);
35814 SocketDescriptor_free(this_ptr_conv);
35817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35818 LDKPeerHandleError this_obj_conv;
35819 this_obj_conv.inner = (void*)(this_obj & (~1));
35820 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35822 PeerHandleError_free(this_obj_conv);
35825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
35826 LDKPeerHandleError this_ptr_conv;
35827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35828 this_ptr_conv.is_owned = false;
35829 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35830 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
35834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
35835 LDKPeerHandleError this_ptr_conv;
35836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
35837 this_ptr_conv.is_owned = false;
35838 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35839 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
35842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
35843 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
35844 int64_t ret_ref = 0;
35845 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35846 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35847 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35848 ret_ref = (uintptr_t)ret_var.inner;
35849 if (ret_var.is_owned) {
35855 static inline uintptr_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
35856 LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
35857 int64_t ret_ref = 0;
35858 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35859 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35860 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35861 ret_ref = (uintptr_t)ret_var.inner;
35862 if (ret_var.is_owned) {
35867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35868 LDKPeerHandleError arg_conv;
35869 arg_conv.inner = (void*)(arg & (~1));
35870 arg_conv.is_owned = false;
35871 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35872 int64_t ret_val = PeerHandleError_clone_ptr(&arg_conv);
35876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35877 LDKPeerHandleError orig_conv;
35878 orig_conv.inner = (void*)(orig & (~1));
35879 orig_conv.is_owned = false;
35880 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35881 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
35882 int64_t ret_ref = 0;
35883 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35884 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35885 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35886 ret_ref = (uintptr_t)ret_var.inner;
35887 if (ret_var.is_owned) {
35893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
35894 LDKPeerManager this_obj_conv;
35895 this_obj_conv.inner = (void*)(this_obj & (~1));
35896 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
35897 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35898 PeerManager_free(this_obj_conv);
35901 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) {
35902 LDKMessageHandler message_handler_conv;
35903 message_handler_conv.inner = (void*)(message_handler & (~1));
35904 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
35905 CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
35906 // WARNING: we need a move here but no clone is available for LDKMessageHandler
35907 LDKSecretKey our_node_secret_ref;
35908 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
35909 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
35910 unsigned char ephemeral_random_data_arr[32];
35911 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
35912 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
35913 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
35914 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
35915 CHECK_ACCESS(logger_ptr);
35916 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
35917 if (logger_conv.free == LDKLogger_JCalls_free) {
35918 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35919 LDKLogger_JCalls_cloned(&logger_conv);
35921 void* custom_message_handler_ptr = (void*)(((uintptr_t)custom_message_handler) & ~1);
35922 CHECK_ACCESS(custom_message_handler_ptr);
35923 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
35924 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
35925 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35926 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
35928 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
35929 int64_t ret_ref = 0;
35930 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
35931 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
35932 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35933 ret_ref = (uintptr_t)ret_var.inner;
35934 if (ret_var.is_owned) {
35940 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
35941 LDKPeerManager this_arg_conv;
35942 this_arg_conv.inner = (void*)(this_arg & (~1));
35943 this_arg_conv.is_owned = false;
35944 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35945 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
35946 jobjectArray ret_arr = NULL;
35947 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
35949 for (size_t i = 0; i < ret_var.datalen; i++) {
35950 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
35951 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
35952 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
35955 FREE(ret_var.data);
35959 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) {
35960 LDKPeerManager this_arg_conv;
35961 this_arg_conv.inner = (void*)(this_arg & (~1));
35962 this_arg_conv.is_owned = false;
35963 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35964 LDKPublicKey their_node_id_ref;
35965 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
35966 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
35967 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
35968 CHECK_ACCESS(descriptor_ptr);
35969 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
35970 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
35971 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35972 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
35974 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
35975 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
35976 return (int64_t)ret_conv;
35979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
35980 LDKPeerManager this_arg_conv;
35981 this_arg_conv.inner = (void*)(this_arg & (~1));
35982 this_arg_conv.is_owned = false;
35983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35984 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
35985 CHECK_ACCESS(descriptor_ptr);
35986 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
35987 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
35988 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
35989 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
35991 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
35992 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
35993 return (int64_t)ret_conv;
35996 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) {
35997 LDKPeerManager this_arg_conv;
35998 this_arg_conv.inner = (void*)(this_arg & (~1));
35999 this_arg_conv.is_owned = false;
36000 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36001 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
36002 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
36003 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
36004 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
36005 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
36006 return (int64_t)ret_conv;
36009 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) {
36010 LDKPeerManager this_arg_conv;
36011 this_arg_conv.inner = (void*)(this_arg & (~1));
36012 this_arg_conv.is_owned = false;
36013 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36014 void* peer_descriptor_ptr = (void*)(((uintptr_t)peer_descriptor) & ~1);
36015 if (!(peer_descriptor & 1)) { CHECK_ACCESS(peer_descriptor_ptr); }
36016 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
36017 LDKu8slice data_ref;
36018 data_ref.datalen = (*env)->GetArrayLength(env, data);
36019 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
36020 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
36021 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
36022 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
36023 return (int64_t)ret_conv;
36026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
36027 LDKPeerManager this_arg_conv;
36028 this_arg_conv.inner = (void*)(this_arg & (~1));
36029 this_arg_conv.is_owned = false;
36030 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36031 PeerManager_process_events(&this_arg_conv);
36034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
36035 LDKPeerManager this_arg_conv;
36036 this_arg_conv.inner = (void*)(this_arg & (~1));
36037 this_arg_conv.is_owned = false;
36038 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36039 void* descriptor_ptr = (void*)(((uintptr_t)descriptor) & ~1);
36040 if (!(descriptor & 1)) { CHECK_ACCESS(descriptor_ptr); }
36041 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
36042 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
36045 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) {
36046 LDKPeerManager this_arg_conv;
36047 this_arg_conv.inner = (void*)(this_arg & (~1));
36048 this_arg_conv.is_owned = false;
36049 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36050 LDKPublicKey node_id_ref;
36051 CHECK((*env)->GetArrayLength(env, node_id) == 33);
36052 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
36053 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
36056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
36057 LDKPeerManager this_arg_conv;
36058 this_arg_conv.inner = (void*)(this_arg & (~1));
36059 this_arg_conv.is_owned = false;
36060 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36061 PeerManager_disconnect_all_peers(&this_arg_conv);
36064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
36065 LDKPeerManager this_arg_conv;
36066 this_arg_conv.inner = (void*)(this_arg & (~1));
36067 this_arg_conv.is_owned = false;
36068 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36069 PeerManager_timer_tick_occurred(&this_arg_conv);
36072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
36073 int64_t ret_val = htlc_success_tx_weight(opt_anchors);
36077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) {
36078 int64_t ret_val = htlc_timeout_tx_weight(opt_anchors);
36082 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
36083 unsigned char commitment_seed_arr[32];
36084 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
36085 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
36086 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
36087 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36088 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
36092 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) {
36093 LDKCVec_u8Z to_holder_script_ref;
36094 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
36095 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
36096 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
36097 LDKCVec_u8Z to_counterparty_script_ref;
36098 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
36099 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
36100 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
36101 LDKOutPoint funding_outpoint_conv;
36102 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
36103 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
36104 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36105 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36106 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);
36107 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36108 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36109 Transaction_free(ret_var);
36113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36114 LDKCounterpartyCommitmentSecrets this_obj_conv;
36115 this_obj_conv.inner = (void*)(this_obj & (~1));
36116 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36118 CounterpartyCommitmentSecrets_free(this_obj_conv);
36121 static inline uintptr_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
36122 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
36123 int64_t ret_ref = 0;
36124 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36125 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36126 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36127 ret_ref = (uintptr_t)ret_var.inner;
36128 if (ret_var.is_owned) {
36133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36134 LDKCounterpartyCommitmentSecrets arg_conv;
36135 arg_conv.inner = (void*)(arg & (~1));
36136 arg_conv.is_owned = false;
36137 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36138 int64_t ret_val = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
36142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36143 LDKCounterpartyCommitmentSecrets orig_conv;
36144 orig_conv.inner = (void*)(orig & (~1));
36145 orig_conv.is_owned = false;
36146 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36147 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
36148 int64_t ret_ref = 0;
36149 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36150 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36151 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36152 ret_ref = (uintptr_t)ret_var.inner;
36153 if (ret_var.is_owned) {
36159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
36160 LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
36161 int64_t ret_ref = 0;
36162 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36163 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36164 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36165 ret_ref = (uintptr_t)ret_var.inner;
36166 if (ret_var.is_owned) {
36172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
36173 LDKCounterpartyCommitmentSecrets this_arg_conv;
36174 this_arg_conv.inner = (void*)(this_arg & (~1));
36175 this_arg_conv.is_owned = false;
36176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36177 int64_t ret_val = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
36181 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) {
36182 LDKCounterpartyCommitmentSecrets this_arg_conv;
36183 this_arg_conv.inner = (void*)(this_arg & (~1));
36184 this_arg_conv.is_owned = false;
36185 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36186 LDKThirtyTwoBytes secret_ref;
36187 CHECK((*env)->GetArrayLength(env, secret) == 32);
36188 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
36189 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
36190 *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
36191 return (int64_t)ret_conv;
36194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
36195 LDKCounterpartyCommitmentSecrets this_arg_conv;
36196 this_arg_conv.inner = (void*)(this_arg & (~1));
36197 this_arg_conv.is_owned = false;
36198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36199 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36200 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
36204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
36205 LDKCounterpartyCommitmentSecrets obj_conv;
36206 obj_conv.inner = (void*)(obj & (~1));
36207 obj_conv.is_owned = false;
36208 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36209 LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
36210 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36211 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36212 CVec_u8Z_free(ret_var);
36216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36217 LDKu8slice ser_ref;
36218 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36219 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36220 LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36221 *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
36222 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36223 return (int64_t)ret_conv;
36226 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) {
36227 LDKPublicKey per_commitment_point_ref;
36228 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36229 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36230 unsigned char base_secret_arr[32];
36231 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
36232 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
36233 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
36234 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36235 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
36236 return (int64_t)ret_conv;
36239 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) {
36240 LDKPublicKey per_commitment_point_ref;
36241 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36242 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36243 LDKPublicKey base_point_ref;
36244 CHECK((*env)->GetArrayLength(env, base_point) == 33);
36245 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
36246 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36247 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
36248 return (int64_t)ret_conv;
36251 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) {
36252 unsigned char per_commitment_secret_arr[32];
36253 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
36254 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
36255 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
36256 unsigned char countersignatory_revocation_base_secret_arr[32];
36257 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
36258 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
36259 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
36260 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
36261 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
36262 return (int64_t)ret_conv;
36265 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) {
36266 LDKPublicKey per_commitment_point_ref;
36267 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36268 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36269 LDKPublicKey countersignatory_revocation_base_point_ref;
36270 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
36271 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
36272 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
36273 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
36274 return (int64_t)ret_conv;
36277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36278 LDKTxCreationKeys this_obj_conv;
36279 this_obj_conv.inner = (void*)(this_obj & (~1));
36280 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36281 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36282 TxCreationKeys_free(this_obj_conv);
36285 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
36286 LDKTxCreationKeys this_ptr_conv;
36287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36288 this_ptr_conv.is_owned = false;
36289 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36290 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36291 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
36295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36296 LDKTxCreationKeys this_ptr_conv;
36297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36298 this_ptr_conv.is_owned = false;
36299 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36300 LDKPublicKey val_ref;
36301 CHECK((*env)->GetArrayLength(env, val) == 33);
36302 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36303 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
36306 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36307 LDKTxCreationKeys this_ptr_conv;
36308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36309 this_ptr_conv.is_owned = false;
36310 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36311 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36312 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
36316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36317 LDKTxCreationKeys this_ptr_conv;
36318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36319 this_ptr_conv.is_owned = false;
36320 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36321 LDKPublicKey val_ref;
36322 CHECK((*env)->GetArrayLength(env, val) == 33);
36323 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36324 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
36327 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36328 LDKTxCreationKeys this_ptr_conv;
36329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36330 this_ptr_conv.is_owned = false;
36331 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36332 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36333 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
36337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36338 LDKTxCreationKeys this_ptr_conv;
36339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36340 this_ptr_conv.is_owned = false;
36341 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36342 LDKPublicKey val_ref;
36343 CHECK((*env)->GetArrayLength(env, val) == 33);
36344 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36345 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
36348 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36349 LDKTxCreationKeys this_ptr_conv;
36350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36351 this_ptr_conv.is_owned = false;
36352 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36353 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36354 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
36358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36359 LDKTxCreationKeys this_ptr_conv;
36360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36361 this_ptr_conv.is_owned = false;
36362 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36363 LDKPublicKey val_ref;
36364 CHECK((*env)->GetArrayLength(env, val) == 33);
36365 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36366 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
36369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
36370 LDKTxCreationKeys this_ptr_conv;
36371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36372 this_ptr_conv.is_owned = false;
36373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36374 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36375 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
36379 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) {
36380 LDKTxCreationKeys this_ptr_conv;
36381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36382 this_ptr_conv.is_owned = false;
36383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36384 LDKPublicKey val_ref;
36385 CHECK((*env)->GetArrayLength(env, val) == 33);
36386 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36387 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
36390 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) {
36391 LDKPublicKey per_commitment_point_arg_ref;
36392 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
36393 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
36394 LDKPublicKey revocation_key_arg_ref;
36395 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
36396 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
36397 LDKPublicKey broadcaster_htlc_key_arg_ref;
36398 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
36399 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
36400 LDKPublicKey countersignatory_htlc_key_arg_ref;
36401 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
36402 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
36403 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
36404 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
36405 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
36406 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);
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 TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
36419 LDKTxCreationKeys ret_var = TxCreationKeys_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_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36431 LDKTxCreationKeys 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_val = TxCreationKeys_clone_ptr(&arg_conv);
36439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36440 LDKTxCreationKeys 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 LDKTxCreationKeys ret_var = TxCreationKeys_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 int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
36457 LDKTxCreationKeys obj_conv;
36458 obj_conv.inner = (void*)(obj & (~1));
36459 obj_conv.is_owned = false;
36460 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36461 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
36462 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36463 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36464 CVec_u8Z_free(ret_var);
36468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36469 LDKu8slice ser_ref;
36470 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36471 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36472 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36473 *ret_conv = TxCreationKeys_read(ser_ref);
36474 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36475 return (int64_t)ret_conv;
36478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36479 LDKChannelPublicKeys this_obj_conv;
36480 this_obj_conv.inner = (void*)(this_obj & (~1));
36481 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36482 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36483 ChannelPublicKeys_free(this_obj_conv);
36486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
36487 LDKChannelPublicKeys this_ptr_conv;
36488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36489 this_ptr_conv.is_owned = false;
36490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36491 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36492 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
36496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36497 LDKChannelPublicKeys this_ptr_conv;
36498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36499 this_ptr_conv.is_owned = false;
36500 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36501 LDKPublicKey val_ref;
36502 CHECK((*env)->GetArrayLength(env, val) == 33);
36503 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36504 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
36507 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
36508 LDKChannelPublicKeys this_ptr_conv;
36509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36510 this_ptr_conv.is_owned = false;
36511 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36512 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36513 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
36517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36518 LDKChannelPublicKeys this_ptr_conv;
36519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36520 this_ptr_conv.is_owned = false;
36521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36522 LDKPublicKey val_ref;
36523 CHECK((*env)->GetArrayLength(env, val) == 33);
36524 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36525 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
36528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
36529 LDKChannelPublicKeys this_ptr_conv;
36530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36531 this_ptr_conv.is_owned = false;
36532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36533 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36534 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
36538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36539 LDKChannelPublicKeys this_ptr_conv;
36540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36541 this_ptr_conv.is_owned = false;
36542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36543 LDKPublicKey val_ref;
36544 CHECK((*env)->GetArrayLength(env, val) == 33);
36545 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36546 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
36549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
36550 LDKChannelPublicKeys this_ptr_conv;
36551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36552 this_ptr_conv.is_owned = false;
36553 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36554 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36555 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
36559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36560 LDKChannelPublicKeys this_ptr_conv;
36561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36562 this_ptr_conv.is_owned = false;
36563 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36564 LDKPublicKey val_ref;
36565 CHECK((*env)->GetArrayLength(env, val) == 33);
36566 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36567 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
36570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
36571 LDKChannelPublicKeys this_ptr_conv;
36572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36573 this_ptr_conv.is_owned = false;
36574 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36575 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
36576 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
36580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36581 LDKChannelPublicKeys this_ptr_conv;
36582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36583 this_ptr_conv.is_owned = false;
36584 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36585 LDKPublicKey val_ref;
36586 CHECK((*env)->GetArrayLength(env, val) == 33);
36587 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
36588 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
36591 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) {
36592 LDKPublicKey funding_pubkey_arg_ref;
36593 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
36594 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
36595 LDKPublicKey revocation_basepoint_arg_ref;
36596 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
36597 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
36598 LDKPublicKey payment_point_arg_ref;
36599 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
36600 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
36601 LDKPublicKey delayed_payment_basepoint_arg_ref;
36602 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
36603 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
36604 LDKPublicKey htlc_basepoint_arg_ref;
36605 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
36606 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
36607 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);
36608 int64_t ret_ref = 0;
36609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36612 ret_ref = (uintptr_t)ret_var.inner;
36613 if (ret_var.is_owned) {
36619 static inline uintptr_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
36620 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
36621 int64_t ret_ref = 0;
36622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36625 ret_ref = (uintptr_t)ret_var.inner;
36626 if (ret_var.is_owned) {
36631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36632 LDKChannelPublicKeys arg_conv;
36633 arg_conv.inner = (void*)(arg & (~1));
36634 arg_conv.is_owned = false;
36635 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36636 int64_t ret_val = ChannelPublicKeys_clone_ptr(&arg_conv);
36640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36641 LDKChannelPublicKeys orig_conv;
36642 orig_conv.inner = (void*)(orig & (~1));
36643 orig_conv.is_owned = false;
36644 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36645 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
36646 int64_t ret_ref = 0;
36647 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36648 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36649 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36650 ret_ref = (uintptr_t)ret_var.inner;
36651 if (ret_var.is_owned) {
36657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
36658 LDKChannelPublicKeys obj_conv;
36659 obj_conv.inner = (void*)(obj & (~1));
36660 obj_conv.is_owned = false;
36661 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36662 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
36663 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36664 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36665 CVec_u8Z_free(ret_var);
36669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36670 LDKu8slice ser_ref;
36671 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36672 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36673 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36674 *ret_conv = ChannelPublicKeys_read(ser_ref);
36675 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36676 return (int64_t)ret_conv;
36679 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) {
36680 LDKPublicKey per_commitment_point_ref;
36681 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36682 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36683 LDKPublicKey broadcaster_delayed_payment_base_ref;
36684 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
36685 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
36686 LDKPublicKey broadcaster_htlc_base_ref;
36687 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
36688 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
36689 LDKPublicKey countersignatory_revocation_base_ref;
36690 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
36691 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
36692 LDKPublicKey countersignatory_htlc_base_ref;
36693 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
36694 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
36695 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
36696 *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);
36697 return (int64_t)ret_conv;
36700 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) {
36701 LDKPublicKey per_commitment_point_ref;
36702 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
36703 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
36704 LDKChannelPublicKeys broadcaster_keys_conv;
36705 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
36706 broadcaster_keys_conv.is_owned = false;
36707 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
36708 LDKChannelPublicKeys countersignatory_keys_conv;
36709 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
36710 countersignatory_keys_conv.is_owned = false;
36711 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
36712 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
36713 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
36714 return (int64_t)ret_conv;
36717 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) {
36718 LDKPublicKey revocation_key_ref;
36719 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
36720 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
36721 LDKPublicKey broadcaster_delayed_payment_key_ref;
36722 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
36723 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
36724 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
36725 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36726 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36727 CVec_u8Z_free(ret_var);
36731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36732 LDKHTLCOutputInCommitment this_obj_conv;
36733 this_obj_conv.inner = (void*)(this_obj & (~1));
36734 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36735 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36736 HTLCOutputInCommitment_free(this_obj_conv);
36739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
36740 LDKHTLCOutputInCommitment this_ptr_conv;
36741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36742 this_ptr_conv.is_owned = false;
36743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36744 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
36748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
36749 LDKHTLCOutputInCommitment this_ptr_conv;
36750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36751 this_ptr_conv.is_owned = false;
36752 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36753 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
36756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
36757 LDKHTLCOutputInCommitment this_ptr_conv;
36758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36759 this_ptr_conv.is_owned = false;
36760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36761 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
36765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36766 LDKHTLCOutputInCommitment this_ptr_conv;
36767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36768 this_ptr_conv.is_owned = false;
36769 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36770 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
36773 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
36774 LDKHTLCOutputInCommitment this_ptr_conv;
36775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36776 this_ptr_conv.is_owned = false;
36777 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36778 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
36782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
36783 LDKHTLCOutputInCommitment this_ptr_conv;
36784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36785 this_ptr_conv.is_owned = false;
36786 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36787 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
36790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
36791 LDKHTLCOutputInCommitment this_ptr_conv;
36792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36793 this_ptr_conv.is_owned = false;
36794 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36795 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
36796 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
36800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
36801 LDKHTLCOutputInCommitment this_ptr_conv;
36802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36803 this_ptr_conv.is_owned = false;
36804 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36805 LDKThirtyTwoBytes val_ref;
36806 CHECK((*env)->GetArrayLength(env, val) == 32);
36807 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
36808 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
36811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
36812 LDKHTLCOutputInCommitment this_ptr_conv;
36813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36814 this_ptr_conv.is_owned = false;
36815 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36816 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
36817 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
36818 int64_t ret_ref = (uintptr_t)ret_copy;
36822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
36823 LDKHTLCOutputInCommitment this_ptr_conv;
36824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36825 this_ptr_conv.is_owned = false;
36826 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36827 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
36828 CHECK_ACCESS(val_ptr);
36829 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
36830 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)val) & ~1));
36831 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
36834 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) {
36835 LDKThirtyTwoBytes payment_hash_arg_ref;
36836 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
36837 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
36838 void* transaction_output_index_arg_ptr = (void*)(((uintptr_t)transaction_output_index_arg) & ~1);
36839 CHECK_ACCESS(transaction_output_index_arg_ptr);
36840 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
36841 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uintptr_t)transaction_output_index_arg) & ~1));
36842 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
36843 int64_t ret_ref = 0;
36844 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36845 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36846 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36847 ret_ref = (uintptr_t)ret_var.inner;
36848 if (ret_var.is_owned) {
36854 static inline uintptr_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
36855 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
36856 int64_t ret_ref = 0;
36857 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36858 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36859 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36860 ret_ref = (uintptr_t)ret_var.inner;
36861 if (ret_var.is_owned) {
36866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36867 LDKHTLCOutputInCommitment arg_conv;
36868 arg_conv.inner = (void*)(arg & (~1));
36869 arg_conv.is_owned = false;
36870 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36871 int64_t ret_val = HTLCOutputInCommitment_clone_ptr(&arg_conv);
36875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36876 LDKHTLCOutputInCommitment orig_conv;
36877 orig_conv.inner = (void*)(orig & (~1));
36878 orig_conv.is_owned = false;
36879 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36880 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
36881 int64_t ret_ref = 0;
36882 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36883 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36884 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36885 ret_ref = (uintptr_t)ret_var.inner;
36886 if (ret_var.is_owned) {
36892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
36893 LDKHTLCOutputInCommitment obj_conv;
36894 obj_conv.inner = (void*)(obj & (~1));
36895 obj_conv.is_owned = false;
36896 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36897 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
36898 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36899 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36900 CVec_u8Z_free(ret_var);
36904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
36905 LDKu8slice ser_ref;
36906 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
36907 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
36908 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36909 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
36910 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
36911 return (int64_t)ret_conv;
36914 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) {
36915 LDKHTLCOutputInCommitment htlc_conv;
36916 htlc_conv.inner = (void*)(htlc & (~1));
36917 htlc_conv.is_owned = false;
36918 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
36919 LDKTxCreationKeys keys_conv;
36920 keys_conv.inner = (void*)(keys & (~1));
36921 keys_conv.is_owned = false;
36922 CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
36923 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
36924 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36925 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36926 CVec_u8Z_free(ret_var);
36930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
36931 LDKPublicKey broadcaster_ref;
36932 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
36933 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
36934 LDKPublicKey countersignatory_ref;
36935 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
36936 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
36937 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
36938 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36939 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36940 CVec_u8Z_free(ret_var);
36944 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) {
36945 unsigned char commitment_txid_arr[32];
36946 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
36947 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
36948 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
36949 LDKHTLCOutputInCommitment htlc_conv;
36950 htlc_conv.inner = (void*)(htlc & (~1));
36951 htlc_conv.is_owned = false;
36952 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
36953 LDKPublicKey broadcaster_delayed_payment_key_ref;
36954 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
36955 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
36956 LDKPublicKey revocation_key_ref;
36957 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
36958 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
36959 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);
36960 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36961 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36962 Transaction_free(ret_var);
36966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
36967 LDKPublicKey funding_pubkey_ref;
36968 CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
36969 (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
36970 LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
36971 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
36972 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
36973 CVec_u8Z_free(ret_var);
36977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
36978 LDKChannelTransactionParameters this_obj_conv;
36979 this_obj_conv.inner = (void*)(this_obj & (~1));
36980 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
36981 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36982 ChannelTransactionParameters_free(this_obj_conv);
36985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
36986 LDKChannelTransactionParameters this_ptr_conv;
36987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
36988 this_ptr_conv.is_owned = false;
36989 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36990 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
36991 int64_t ret_ref = 0;
36992 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
36993 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
36994 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36995 ret_ref = (uintptr_t)ret_var.inner;
36996 if (ret_var.is_owned) {
37002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37003 LDKChannelTransactionParameters this_ptr_conv;
37004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37005 this_ptr_conv.is_owned = false;
37006 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37007 LDKChannelPublicKeys val_conv;
37008 val_conv.inner = (void*)(val & (~1));
37009 val_conv.is_owned = (val & 1) || (val == 0);
37010 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37011 val_conv = ChannelPublicKeys_clone(&val_conv);
37012 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
37015 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
37016 LDKChannelTransactionParameters this_ptr_conv;
37017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37018 this_ptr_conv.is_owned = false;
37019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37020 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
37024 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) {
37025 LDKChannelTransactionParameters this_ptr_conv;
37026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37027 this_ptr_conv.is_owned = false;
37028 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37029 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
37032 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
37033 LDKChannelTransactionParameters this_ptr_conv;
37034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37035 this_ptr_conv.is_owned = false;
37036 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37037 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
37041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
37042 LDKChannelTransactionParameters this_ptr_conv;
37043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37044 this_ptr_conv.is_owned = false;
37045 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37046 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
37049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
37050 LDKChannelTransactionParameters this_ptr_conv;
37051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37052 this_ptr_conv.is_owned = false;
37053 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37054 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
37055 int64_t ret_ref = 0;
37056 if ((uintptr_t)ret_var.inner > 4096) {
37057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37060 ret_ref = (uintptr_t)ret_var.inner;
37061 if (ret_var.is_owned) {
37068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37069 LDKChannelTransactionParameters this_ptr_conv;
37070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37071 this_ptr_conv.is_owned = false;
37072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37073 LDKCounterpartyChannelTransactionParameters val_conv;
37074 val_conv.inner = (void*)(val & (~1));
37075 val_conv.is_owned = (val & 1) || (val == 0);
37076 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37077 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
37078 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
37081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
37082 LDKChannelTransactionParameters this_ptr_conv;
37083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37084 this_ptr_conv.is_owned = false;
37085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37086 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
37087 int64_t ret_ref = 0;
37088 if ((uintptr_t)ret_var.inner > 4096) {
37089 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37090 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37091 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37092 ret_ref = (uintptr_t)ret_var.inner;
37093 if (ret_var.is_owned) {
37100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37101 LDKChannelTransactionParameters this_ptr_conv;
37102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37103 this_ptr_conv.is_owned = false;
37104 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37105 LDKOutPoint val_conv;
37106 val_conv.inner = (void*)(val & (~1));
37107 val_conv.is_owned = (val & 1) || (val == 0);
37108 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37109 val_conv = OutPoint_clone(&val_conv);
37110 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
37113 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) {
37114 LDKChannelTransactionParameters this_ptr_conv;
37115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37116 this_ptr_conv.is_owned = false;
37117 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37118 jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
37122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
37123 LDKChannelTransactionParameters this_ptr_conv;
37124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37125 this_ptr_conv.is_owned = false;
37126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37127 LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
37128 ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
37131 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) {
37132 LDKChannelPublicKeys holder_pubkeys_arg_conv;
37133 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
37134 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
37135 CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
37136 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
37137 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
37138 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
37139 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
37140 CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
37141 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
37142 LDKOutPoint funding_outpoint_arg_conv;
37143 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
37144 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
37145 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
37146 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
37147 LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg);
37148 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);
37149 int64_t ret_ref = 0;
37150 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37151 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37152 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37153 ret_ref = (uintptr_t)ret_var.inner;
37154 if (ret_var.is_owned) {
37160 static inline uintptr_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
37161 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
37162 int64_t ret_ref = 0;
37163 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37164 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37165 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37166 ret_ref = (uintptr_t)ret_var.inner;
37167 if (ret_var.is_owned) {
37172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37173 LDKChannelTransactionParameters arg_conv;
37174 arg_conv.inner = (void*)(arg & (~1));
37175 arg_conv.is_owned = false;
37176 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37177 int64_t ret_val = ChannelTransactionParameters_clone_ptr(&arg_conv);
37181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37182 LDKChannelTransactionParameters orig_conv;
37183 orig_conv.inner = (void*)(orig & (~1));
37184 orig_conv.is_owned = false;
37185 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37186 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
37187 int64_t ret_ref = 0;
37188 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37189 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37190 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37191 ret_ref = (uintptr_t)ret_var.inner;
37192 if (ret_var.is_owned) {
37198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37199 LDKCounterpartyChannelTransactionParameters this_obj_conv;
37200 this_obj_conv.inner = (void*)(this_obj & (~1));
37201 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37203 CounterpartyChannelTransactionParameters_free(this_obj_conv);
37206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
37207 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37209 this_ptr_conv.is_owned = false;
37210 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37211 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
37212 int64_t ret_ref = 0;
37213 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37214 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37215 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37216 ret_ref = (uintptr_t)ret_var.inner;
37217 if (ret_var.is_owned) {
37223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
37224 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37226 this_ptr_conv.is_owned = false;
37227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37228 LDKChannelPublicKeys val_conv;
37229 val_conv.inner = (void*)(val & (~1));
37230 val_conv.is_owned = (val & 1) || (val == 0);
37231 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37232 val_conv = ChannelPublicKeys_clone(&val_conv);
37233 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
37236 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
37237 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37239 this_ptr_conv.is_owned = false;
37240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37241 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
37245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
37246 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
37247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37248 this_ptr_conv.is_owned = false;
37249 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37250 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
37253 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) {
37254 LDKChannelPublicKeys pubkeys_arg_conv;
37255 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
37256 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
37257 CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
37258 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
37259 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
37260 int64_t ret_ref = 0;
37261 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37262 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37263 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37264 ret_ref = (uintptr_t)ret_var.inner;
37265 if (ret_var.is_owned) {
37271 static inline uintptr_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
37272 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
37273 int64_t ret_ref = 0;
37274 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37275 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37276 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37277 ret_ref = (uintptr_t)ret_var.inner;
37278 if (ret_var.is_owned) {
37283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37284 LDKCounterpartyChannelTransactionParameters arg_conv;
37285 arg_conv.inner = (void*)(arg & (~1));
37286 arg_conv.is_owned = false;
37287 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37288 int64_t ret_val = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
37292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37293 LDKCounterpartyChannelTransactionParameters orig_conv;
37294 orig_conv.inner = (void*)(orig & (~1));
37295 orig_conv.is_owned = false;
37296 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37297 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
37298 int64_t ret_ref = 0;
37299 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37300 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37301 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37302 ret_ref = (uintptr_t)ret_var.inner;
37303 if (ret_var.is_owned) {
37309 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
37310 LDKChannelTransactionParameters this_arg_conv;
37311 this_arg_conv.inner = (void*)(this_arg & (~1));
37312 this_arg_conv.is_owned = false;
37313 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37314 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
37318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
37319 LDKChannelTransactionParameters this_arg_conv;
37320 this_arg_conv.inner = (void*)(this_arg & (~1));
37321 this_arg_conv.is_owned = false;
37322 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37323 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
37324 int64_t ret_ref = 0;
37325 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37326 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37327 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37328 ret_ref = (uintptr_t)ret_var.inner;
37329 if (ret_var.is_owned) {
37335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
37336 LDKChannelTransactionParameters this_arg_conv;
37337 this_arg_conv.inner = (void*)(this_arg & (~1));
37338 this_arg_conv.is_owned = false;
37339 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37340 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
37341 int64_t ret_ref = 0;
37342 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37343 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37344 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37345 ret_ref = (uintptr_t)ret_var.inner;
37346 if (ret_var.is_owned) {
37352 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
37353 LDKCounterpartyChannelTransactionParameters obj_conv;
37354 obj_conv.inner = (void*)(obj & (~1));
37355 obj_conv.is_owned = false;
37356 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37357 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
37358 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37359 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37360 CVec_u8Z_free(ret_var);
37364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37365 LDKu8slice ser_ref;
37366 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37367 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37368 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
37369 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
37370 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37371 return (int64_t)ret_conv;
37374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
37375 LDKChannelTransactionParameters obj_conv;
37376 obj_conv.inner = (void*)(obj & (~1));
37377 obj_conv.is_owned = false;
37378 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37379 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
37380 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37381 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37382 CVec_u8Z_free(ret_var);
37386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37387 LDKu8slice ser_ref;
37388 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37389 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37390 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
37391 *ret_conv = ChannelTransactionParameters_read(ser_ref);
37392 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37393 return (int64_t)ret_conv;
37396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37397 LDKDirectedChannelTransactionParameters this_obj_conv;
37398 this_obj_conv.inner = (void*)(this_obj & (~1));
37399 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37400 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37401 DirectedChannelTransactionParameters_free(this_obj_conv);
37404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
37405 LDKDirectedChannelTransactionParameters this_arg_conv;
37406 this_arg_conv.inner = (void*)(this_arg & (~1));
37407 this_arg_conv.is_owned = false;
37408 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37409 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
37410 int64_t ret_ref = 0;
37411 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37412 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37413 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37414 ret_ref = (uintptr_t)ret_var.inner;
37415 if (ret_var.is_owned) {
37421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
37422 LDKDirectedChannelTransactionParameters this_arg_conv;
37423 this_arg_conv.inner = (void*)(this_arg & (~1));
37424 this_arg_conv.is_owned = false;
37425 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37426 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
37427 int64_t ret_ref = 0;
37428 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37429 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37430 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37431 ret_ref = (uintptr_t)ret_var.inner;
37432 if (ret_var.is_owned) {
37438 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
37439 LDKDirectedChannelTransactionParameters this_arg_conv;
37440 this_arg_conv.inner = (void*)(this_arg & (~1));
37441 this_arg_conv.is_owned = false;
37442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37443 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
37447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
37448 LDKDirectedChannelTransactionParameters this_arg_conv;
37449 this_arg_conv.inner = (void*)(this_arg & (~1));
37450 this_arg_conv.is_owned = false;
37451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37452 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
37456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
37457 LDKDirectedChannelTransactionParameters this_arg_conv;
37458 this_arg_conv.inner = (void*)(this_arg & (~1));
37459 this_arg_conv.is_owned = false;
37460 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37461 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
37462 int64_t ret_ref = 0;
37463 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37464 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37465 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37466 ret_ref = (uintptr_t)ret_var.inner;
37467 if (ret_var.is_owned) {
37473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
37474 LDKDirectedChannelTransactionParameters this_arg_conv;
37475 this_arg_conv.inner = (void*)(this_arg & (~1));
37476 this_arg_conv.is_owned = false;
37477 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37478 jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
37482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37483 LDKHolderCommitmentTransaction this_obj_conv;
37484 this_obj_conv.inner = (void*)(this_obj & (~1));
37485 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37486 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37487 HolderCommitmentTransaction_free(this_obj_conv);
37490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
37491 LDKHolderCommitmentTransaction this_ptr_conv;
37492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37493 this_ptr_conv.is_owned = false;
37494 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37495 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
37496 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
37500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37501 LDKHolderCommitmentTransaction this_ptr_conv;
37502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37503 this_ptr_conv.is_owned = false;
37504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37505 LDKSignature val_ref;
37506 CHECK((*env)->GetArrayLength(env, val) == 64);
37507 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
37508 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
37511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
37512 LDKHolderCommitmentTransaction this_ptr_conv;
37513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37514 this_ptr_conv.is_owned = false;
37515 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37516 LDKCVec_SignatureZ val_constr;
37517 val_constr.datalen = (*env)->GetArrayLength(env, val);
37518 if (val_constr.datalen > 0)
37519 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
37521 val_constr.data = NULL;
37522 for (size_t i = 0; i < val_constr.datalen; i++) {
37523 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
37524 LDKSignature val_conv_8_ref;
37525 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
37526 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
37527 val_constr.data[i] = val_conv_8_ref;
37529 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
37532 static inline uintptr_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
37533 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
37534 int64_t ret_ref = 0;
37535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37538 ret_ref = (uintptr_t)ret_var.inner;
37539 if (ret_var.is_owned) {
37544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37545 LDKHolderCommitmentTransaction arg_conv;
37546 arg_conv.inner = (void*)(arg & (~1));
37547 arg_conv.is_owned = false;
37548 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37549 int64_t ret_val = HolderCommitmentTransaction_clone_ptr(&arg_conv);
37553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37554 LDKHolderCommitmentTransaction orig_conv;
37555 orig_conv.inner = (void*)(orig & (~1));
37556 orig_conv.is_owned = false;
37557 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37558 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
37559 int64_t ret_ref = 0;
37560 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37561 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37562 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37563 ret_ref = (uintptr_t)ret_var.inner;
37564 if (ret_var.is_owned) {
37570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
37571 LDKHolderCommitmentTransaction obj_conv;
37572 obj_conv.inner = (void*)(obj & (~1));
37573 obj_conv.is_owned = false;
37574 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37575 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
37576 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37577 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37578 CVec_u8Z_free(ret_var);
37582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37583 LDKu8slice ser_ref;
37584 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37585 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37586 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
37587 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
37588 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37589 return (int64_t)ret_conv;
37592 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) {
37593 LDKCommitmentTransaction commitment_tx_conv;
37594 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
37595 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
37596 CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
37597 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
37598 LDKSignature counterparty_sig_ref;
37599 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
37600 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
37601 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
37602 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
37603 if (counterparty_htlc_sigs_constr.datalen > 0)
37604 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
37606 counterparty_htlc_sigs_constr.data = NULL;
37607 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
37608 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
37609 LDKSignature counterparty_htlc_sigs_conv_8_ref;
37610 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
37611 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
37612 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
37614 LDKPublicKey holder_funding_key_ref;
37615 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
37616 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
37617 LDKPublicKey counterparty_funding_key_ref;
37618 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
37619 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
37620 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
37621 int64_t ret_ref = 0;
37622 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37623 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37625 ret_ref = (uintptr_t)ret_var.inner;
37626 if (ret_var.is_owned) {
37632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37633 LDKBuiltCommitmentTransaction this_obj_conv;
37634 this_obj_conv.inner = (void*)(this_obj & (~1));
37635 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37636 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37637 BuiltCommitmentTransaction_free(this_obj_conv);
37640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
37641 LDKBuiltCommitmentTransaction this_ptr_conv;
37642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37643 this_ptr_conv.is_owned = false;
37644 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37645 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
37646 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37647 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37648 Transaction_free(ret_var);
37652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37653 LDKBuiltCommitmentTransaction this_ptr_conv;
37654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37655 this_ptr_conv.is_owned = false;
37656 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37657 LDKTransaction val_ref;
37658 val_ref.datalen = (*env)->GetArrayLength(env, val);
37659 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
37660 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
37661 val_ref.data_is_owned = true;
37662 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
37665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
37666 LDKBuiltCommitmentTransaction this_ptr_conv;
37667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37668 this_ptr_conv.is_owned = false;
37669 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37670 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37671 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
37675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
37676 LDKBuiltCommitmentTransaction this_ptr_conv;
37677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
37678 this_ptr_conv.is_owned = false;
37679 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37680 LDKThirtyTwoBytes val_ref;
37681 CHECK((*env)->GetArrayLength(env, val) == 32);
37682 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
37683 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
37686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
37687 LDKTransaction transaction_arg_ref;
37688 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
37689 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
37690 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
37691 transaction_arg_ref.data_is_owned = true;
37692 LDKThirtyTwoBytes txid_arg_ref;
37693 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
37694 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
37695 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
37696 int64_t ret_ref = 0;
37697 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37698 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37699 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37700 ret_ref = (uintptr_t)ret_var.inner;
37701 if (ret_var.is_owned) {
37707 static inline uintptr_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
37708 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
37709 int64_t ret_ref = 0;
37710 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37711 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37712 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37713 ret_ref = (uintptr_t)ret_var.inner;
37714 if (ret_var.is_owned) {
37719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37720 LDKBuiltCommitmentTransaction arg_conv;
37721 arg_conv.inner = (void*)(arg & (~1));
37722 arg_conv.is_owned = false;
37723 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37724 int64_t ret_val = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
37728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37729 LDKBuiltCommitmentTransaction orig_conv;
37730 orig_conv.inner = (void*)(orig & (~1));
37731 orig_conv.is_owned = false;
37732 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37733 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
37734 int64_t ret_ref = 0;
37735 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37736 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37737 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37738 ret_ref = (uintptr_t)ret_var.inner;
37739 if (ret_var.is_owned) {
37745 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
37746 LDKBuiltCommitmentTransaction obj_conv;
37747 obj_conv.inner = (void*)(obj & (~1));
37748 obj_conv.is_owned = false;
37749 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37750 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
37751 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37752 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37753 CVec_u8Z_free(ret_var);
37757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
37758 LDKu8slice ser_ref;
37759 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
37760 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
37761 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
37762 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
37763 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
37764 return (int64_t)ret_conv;
37767 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) {
37768 LDKBuiltCommitmentTransaction this_arg_conv;
37769 this_arg_conv.inner = (void*)(this_arg & (~1));
37770 this_arg_conv.is_owned = false;
37771 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37772 LDKu8slice funding_redeemscript_ref;
37773 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
37774 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
37775 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37776 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
37777 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
37781 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) {
37782 LDKBuiltCommitmentTransaction this_arg_conv;
37783 this_arg_conv.inner = (void*)(this_arg & (~1));
37784 this_arg_conv.is_owned = false;
37785 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37786 unsigned char funding_key_arr[32];
37787 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
37788 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
37789 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
37790 LDKu8slice funding_redeemscript_ref;
37791 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
37792 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
37793 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
37794 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
37795 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
37799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37800 LDKClosingTransaction this_obj_conv;
37801 this_obj_conv.inner = (void*)(this_obj & (~1));
37802 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37803 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37804 ClosingTransaction_free(this_obj_conv);
37807 static inline uintptr_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
37808 LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
37809 int64_t ret_ref = 0;
37810 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37811 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37812 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37813 ret_ref = (uintptr_t)ret_var.inner;
37814 if (ret_var.is_owned) {
37819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37820 LDKClosingTransaction arg_conv;
37821 arg_conv.inner = (void*)(arg & (~1));
37822 arg_conv.is_owned = false;
37823 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37824 int64_t ret_val = ClosingTransaction_clone_ptr(&arg_conv);
37828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37829 LDKClosingTransaction orig_conv;
37830 orig_conv.inner = (void*)(orig & (~1));
37831 orig_conv.is_owned = false;
37832 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37833 LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
37834 int64_t ret_ref = 0;
37835 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37836 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37837 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37838 ret_ref = (uintptr_t)ret_var.inner;
37839 if (ret_var.is_owned) {
37845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
37846 LDKClosingTransaction o_conv;
37847 o_conv.inner = (void*)(o & (~1));
37848 o_conv.is_owned = false;
37849 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37850 int64_t ret_val = ClosingTransaction_hash(&o_conv);
37854 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) {
37855 LDKCVec_u8Z to_holder_script_ref;
37856 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
37857 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37858 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
37859 LDKCVec_u8Z to_counterparty_script_ref;
37860 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
37861 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37862 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
37863 LDKOutPoint funding_outpoint_conv;
37864 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
37865 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
37866 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37867 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37868 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
37869 int64_t ret_ref = 0;
37870 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37871 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37872 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37873 ret_ref = (uintptr_t)ret_var.inner;
37874 if (ret_var.is_owned) {
37880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
37881 LDKClosingTransaction this_arg_conv;
37882 this_arg_conv.inner = (void*)(this_arg & (~1));
37883 this_arg_conv.is_owned = false;
37884 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37885 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
37886 int64_t ret_ref = 0;
37887 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
37888 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
37889 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37890 ret_ref = (uintptr_t)ret_var.inner;
37891 if (ret_var.is_owned) {
37897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
37898 LDKClosingTransaction this_arg_conv;
37899 this_arg_conv.inner = (void*)(this_arg & (~1));
37900 this_arg_conv.is_owned = false;
37901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37902 LDKOutPoint funding_outpoint_conv;
37903 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
37904 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
37905 CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37906 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37907 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
37908 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
37909 return (int64_t)ret_conv;
37912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
37913 LDKClosingTransaction this_arg_conv;
37914 this_arg_conv.inner = (void*)(this_arg & (~1));
37915 this_arg_conv.is_owned = false;
37916 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37917 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
37921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
37922 LDKClosingTransaction this_arg_conv;
37923 this_arg_conv.inner = (void*)(this_arg & (~1));
37924 this_arg_conv.is_owned = false;
37925 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37926 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
37930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
37931 LDKClosingTransaction this_arg_conv;
37932 this_arg_conv.inner = (void*)(this_arg & (~1));
37933 this_arg_conv.is_owned = false;
37934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37935 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
37936 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37937 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
37942 LDKClosingTransaction this_arg_conv;
37943 this_arg_conv.inner = (void*)(this_arg & (~1));
37944 this_arg_conv.is_owned = false;
37945 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37946 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
37947 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37948 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
37953 LDKTrustedClosingTransaction this_obj_conv;
37954 this_obj_conv.inner = (void*)(this_obj & (~1));
37955 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
37956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37957 TrustedClosingTransaction_free(this_obj_conv);
37960 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
37961 LDKTrustedClosingTransaction this_arg_conv;
37962 this_arg_conv.inner = (void*)(this_arg & (~1));
37963 this_arg_conv.is_owned = false;
37964 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37965 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
37966 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
37967 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
37968 Transaction_free(ret_var);
37972 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) {
37973 LDKTrustedClosingTransaction this_arg_conv;
37974 this_arg_conv.inner = (void*)(this_arg & (~1));
37975 this_arg_conv.is_owned = false;
37976 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37977 LDKu8slice funding_redeemscript_ref;
37978 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
37979 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
37980 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
37981 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
37982 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
37986 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) {
37987 LDKTrustedClosingTransaction this_arg_conv;
37988 this_arg_conv.inner = (void*)(this_arg & (~1));
37989 this_arg_conv.is_owned = false;
37990 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37991 unsigned char funding_key_arr[32];
37992 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
37993 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
37994 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
37995 LDKu8slice funding_redeemscript_ref;
37996 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
37997 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
37998 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
37999 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
38000 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
38004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38005 LDKCommitmentTransaction this_obj_conv;
38006 this_obj_conv.inner = (void*)(this_obj & (~1));
38007 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38008 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38009 CommitmentTransaction_free(this_obj_conv);
38012 static inline uintptr_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
38013 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
38014 int64_t ret_ref = 0;
38015 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38016 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38017 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38018 ret_ref = (uintptr_t)ret_var.inner;
38019 if (ret_var.is_owned) {
38024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38025 LDKCommitmentTransaction arg_conv;
38026 arg_conv.inner = (void*)(arg & (~1));
38027 arg_conv.is_owned = false;
38028 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38029 int64_t ret_val = CommitmentTransaction_clone_ptr(&arg_conv);
38033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38034 LDKCommitmentTransaction orig_conv;
38035 orig_conv.inner = (void*)(orig & (~1));
38036 orig_conv.is_owned = false;
38037 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38038 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
38039 int64_t ret_ref = 0;
38040 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38041 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38042 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38043 ret_ref = (uintptr_t)ret_var.inner;
38044 if (ret_var.is_owned) {
38050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
38051 LDKCommitmentTransaction obj_conv;
38052 obj_conv.inner = (void*)(obj & (~1));
38053 obj_conv.is_owned = false;
38054 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38055 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
38056 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38057 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38058 CVec_u8Z_free(ret_var);
38062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38063 LDKu8slice ser_ref;
38064 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38065 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38066 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
38067 *ret_conv = CommitmentTransaction_read(ser_ref);
38068 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38069 return (int64_t)ret_conv;
38072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
38073 LDKCommitmentTransaction this_arg_conv;
38074 this_arg_conv.inner = (void*)(this_arg & (~1));
38075 this_arg_conv.is_owned = false;
38076 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38077 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
38081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38082 LDKCommitmentTransaction this_arg_conv;
38083 this_arg_conv.inner = (void*)(this_arg & (~1));
38084 this_arg_conv.is_owned = false;
38085 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38086 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
38090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
38091 LDKCommitmentTransaction this_arg_conv;
38092 this_arg_conv.inner = (void*)(this_arg & (~1));
38093 this_arg_conv.is_owned = false;
38094 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38095 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
38099 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
38100 LDKCommitmentTransaction this_arg_conv;
38101 this_arg_conv.inner = (void*)(this_arg & (~1));
38102 this_arg_conv.is_owned = false;
38103 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38104 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
38108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
38109 LDKCommitmentTransaction this_arg_conv;
38110 this_arg_conv.inner = (void*)(this_arg & (~1));
38111 this_arg_conv.is_owned = false;
38112 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38113 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
38114 int64_t ret_ref = 0;
38115 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38116 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38117 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38118 ret_ref = (uintptr_t)ret_var.inner;
38119 if (ret_var.is_owned) {
38125 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) {
38126 LDKCommitmentTransaction this_arg_conv;
38127 this_arg_conv.inner = (void*)(this_arg & (~1));
38128 this_arg_conv.is_owned = false;
38129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38130 LDKDirectedChannelTransactionParameters channel_parameters_conv;
38131 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
38132 channel_parameters_conv.is_owned = false;
38133 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38134 LDKChannelPublicKeys broadcaster_keys_conv;
38135 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
38136 broadcaster_keys_conv.is_owned = false;
38137 CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
38138 LDKChannelPublicKeys countersignatory_keys_conv;
38139 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
38140 countersignatory_keys_conv.is_owned = false;
38141 CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
38142 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
38143 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
38144 return (int64_t)ret_conv;
38147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38148 LDKTrustedCommitmentTransaction this_obj_conv;
38149 this_obj_conv.inner = (void*)(this_obj & (~1));
38150 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38151 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38152 TrustedCommitmentTransaction_free(this_obj_conv);
38155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
38156 LDKTrustedCommitmentTransaction this_arg_conv;
38157 this_arg_conv.inner = (void*)(this_arg & (~1));
38158 this_arg_conv.is_owned = false;
38159 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38160 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
38161 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
38165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
38166 LDKTrustedCommitmentTransaction this_arg_conv;
38167 this_arg_conv.inner = (void*)(this_arg & (~1));
38168 this_arg_conv.is_owned = false;
38169 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38170 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
38171 int64_t ret_ref = 0;
38172 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38173 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38174 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38175 ret_ref = (uintptr_t)ret_var.inner;
38176 if (ret_var.is_owned) {
38182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
38183 LDKTrustedCommitmentTransaction this_arg_conv;
38184 this_arg_conv.inner = (void*)(this_arg & (~1));
38185 this_arg_conv.is_owned = false;
38186 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38187 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
38188 int64_t ret_ref = 0;
38189 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38190 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38191 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38192 ret_ref = (uintptr_t)ret_var.inner;
38193 if (ret_var.is_owned) {
38199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) {
38200 LDKTrustedCommitmentTransaction this_arg_conv;
38201 this_arg_conv.inner = (void*)(this_arg & (~1));
38202 this_arg_conv.is_owned = false;
38203 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38204 jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
38208 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) {
38209 LDKTrustedCommitmentTransaction this_arg_conv;
38210 this_arg_conv.inner = (void*)(this_arg & (~1));
38211 this_arg_conv.is_owned = false;
38212 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38213 unsigned char htlc_base_key_arr[32];
38214 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
38215 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
38216 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
38217 LDKDirectedChannelTransactionParameters channel_parameters_conv;
38218 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
38219 channel_parameters_conv.is_owned = false;
38220 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
38221 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
38222 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
38223 return (int64_t)ret_conv;
38226 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) {
38227 LDKPublicKey broadcaster_payment_basepoint_ref;
38228 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
38229 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
38230 LDKPublicKey countersignatory_payment_basepoint_ref;
38231 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
38232 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
38233 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
38237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38238 LDKInitFeatures a_conv;
38239 a_conv.inner = (void*)(a & (~1));
38240 a_conv.is_owned = false;
38241 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38242 LDKInitFeatures b_conv;
38243 b_conv.inner = (void*)(b & (~1));
38244 b_conv.is_owned = false;
38245 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38246 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
38250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38251 LDKNodeFeatures a_conv;
38252 a_conv.inner = (void*)(a & (~1));
38253 a_conv.is_owned = false;
38254 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38255 LDKNodeFeatures b_conv;
38256 b_conv.inner = (void*)(b & (~1));
38257 b_conv.is_owned = false;
38258 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38259 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
38263 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38264 LDKChannelFeatures a_conv;
38265 a_conv.inner = (void*)(a & (~1));
38266 a_conv.is_owned = false;
38267 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38268 LDKChannelFeatures b_conv;
38269 b_conv.inner = (void*)(b & (~1));
38270 b_conv.is_owned = false;
38271 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38272 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
38276 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38277 LDKInvoiceFeatures a_conv;
38278 a_conv.inner = (void*)(a & (~1));
38279 a_conv.is_owned = false;
38280 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38281 LDKInvoiceFeatures b_conv;
38282 b_conv.inner = (void*)(b & (~1));
38283 b_conv.is_owned = false;
38284 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38285 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
38289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
38290 LDKChannelTypeFeatures a_conv;
38291 a_conv.inner = (void*)(a & (~1));
38292 a_conv.is_owned = false;
38293 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38294 LDKChannelTypeFeatures b_conv;
38295 b_conv.inner = (void*)(b & (~1));
38296 b_conv.is_owned = false;
38297 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38298 jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv);
38302 static inline uintptr_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
38303 LDKInitFeatures ret_var = InitFeatures_clone(arg);
38304 int64_t ret_ref = 0;
38305 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38306 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38307 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38308 ret_ref = (uintptr_t)ret_var.inner;
38309 if (ret_var.is_owned) {
38314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38315 LDKInitFeatures arg_conv;
38316 arg_conv.inner = (void*)(arg & (~1));
38317 arg_conv.is_owned = false;
38318 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38319 int64_t ret_val = InitFeatures_clone_ptr(&arg_conv);
38323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38324 LDKInitFeatures orig_conv;
38325 orig_conv.inner = (void*)(orig & (~1));
38326 orig_conv.is_owned = false;
38327 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38328 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
38329 int64_t ret_ref = 0;
38330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38333 ret_ref = (uintptr_t)ret_var.inner;
38334 if (ret_var.is_owned) {
38340 static inline uintptr_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
38341 LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
38342 int64_t ret_ref = 0;
38343 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38344 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38345 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38346 ret_ref = (uintptr_t)ret_var.inner;
38347 if (ret_var.is_owned) {
38352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38353 LDKNodeFeatures arg_conv;
38354 arg_conv.inner = (void*)(arg & (~1));
38355 arg_conv.is_owned = false;
38356 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38357 int64_t ret_val = NodeFeatures_clone_ptr(&arg_conv);
38361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38362 LDKNodeFeatures orig_conv;
38363 orig_conv.inner = (void*)(orig & (~1));
38364 orig_conv.is_owned = false;
38365 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38366 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
38367 int64_t ret_ref = 0;
38368 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38369 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38370 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38371 ret_ref = (uintptr_t)ret_var.inner;
38372 if (ret_var.is_owned) {
38378 static inline uintptr_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
38379 LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
38380 int64_t ret_ref = 0;
38381 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38382 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38383 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38384 ret_ref = (uintptr_t)ret_var.inner;
38385 if (ret_var.is_owned) {
38390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38391 LDKChannelFeatures arg_conv;
38392 arg_conv.inner = (void*)(arg & (~1));
38393 arg_conv.is_owned = false;
38394 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38395 int64_t ret_val = ChannelFeatures_clone_ptr(&arg_conv);
38399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38400 LDKChannelFeatures orig_conv;
38401 orig_conv.inner = (void*)(orig & (~1));
38402 orig_conv.is_owned = false;
38403 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38404 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
38405 int64_t ret_ref = 0;
38406 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38407 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38408 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38409 ret_ref = (uintptr_t)ret_var.inner;
38410 if (ret_var.is_owned) {
38416 static inline uintptr_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
38417 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
38418 int64_t ret_ref = 0;
38419 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38420 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38421 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38422 ret_ref = (uintptr_t)ret_var.inner;
38423 if (ret_var.is_owned) {
38428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38429 LDKInvoiceFeatures arg_conv;
38430 arg_conv.inner = (void*)(arg & (~1));
38431 arg_conv.is_owned = false;
38432 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38433 int64_t ret_val = InvoiceFeatures_clone_ptr(&arg_conv);
38437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38438 LDKInvoiceFeatures orig_conv;
38439 orig_conv.inner = (void*)(orig & (~1));
38440 orig_conv.is_owned = false;
38441 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38442 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
38443 int64_t ret_ref = 0;
38444 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38445 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38447 ret_ref = (uintptr_t)ret_var.inner;
38448 if (ret_var.is_owned) {
38454 static inline uintptr_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
38455 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
38456 int64_t ret_ref = 0;
38457 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38458 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38459 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38460 ret_ref = (uintptr_t)ret_var.inner;
38461 if (ret_var.is_owned) {
38466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38467 LDKChannelTypeFeatures arg_conv;
38468 arg_conv.inner = (void*)(arg & (~1));
38469 arg_conv.is_owned = false;
38470 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38471 int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv);
38475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38476 LDKChannelTypeFeatures orig_conv;
38477 orig_conv.inner = (void*)(orig & (~1));
38478 orig_conv.is_owned = false;
38479 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38480 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
38481 int64_t ret_ref = 0;
38482 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38483 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38484 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38485 ret_ref = (uintptr_t)ret_var.inner;
38486 if (ret_var.is_owned) {
38492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38493 LDKInitFeatures this_obj_conv;
38494 this_obj_conv.inner = (void*)(this_obj & (~1));
38495 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38496 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38497 InitFeatures_free(this_obj_conv);
38500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38501 LDKNodeFeatures this_obj_conv;
38502 this_obj_conv.inner = (void*)(this_obj & (~1));
38503 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38505 NodeFeatures_free(this_obj_conv);
38508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38509 LDKChannelFeatures this_obj_conv;
38510 this_obj_conv.inner = (void*)(this_obj & (~1));
38511 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38513 ChannelFeatures_free(this_obj_conv);
38516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38517 LDKInvoiceFeatures this_obj_conv;
38518 this_obj_conv.inner = (void*)(this_obj & (~1));
38519 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38520 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38521 InvoiceFeatures_free(this_obj_conv);
38524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38525 LDKChannelTypeFeatures this_obj_conv;
38526 this_obj_conv.inner = (void*)(this_obj & (~1));
38527 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38528 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38529 ChannelTypeFeatures_free(this_obj_conv);
38532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
38533 LDKInitFeatures ret_var = InitFeatures_empty();
38534 int64_t ret_ref = 0;
38535 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38536 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38537 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38538 ret_ref = (uintptr_t)ret_var.inner;
38539 if (ret_var.is_owned) {
38545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
38546 LDKInitFeatures ret_var = InitFeatures_known();
38547 int64_t ret_ref = 0;
38548 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38549 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38550 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38551 ret_ref = (uintptr_t)ret_var.inner;
38552 if (ret_var.is_owned) {
38558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
38559 LDKInitFeatures this_arg_conv;
38560 this_arg_conv.inner = (void*)(this_arg & (~1));
38561 this_arg_conv.is_owned = false;
38562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38563 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
38567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
38568 LDKNodeFeatures ret_var = NodeFeatures_empty();
38569 int64_t ret_ref = 0;
38570 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38571 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38572 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38573 ret_ref = (uintptr_t)ret_var.inner;
38574 if (ret_var.is_owned) {
38580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
38581 LDKNodeFeatures ret_var = NodeFeatures_known();
38582 int64_t ret_ref = 0;
38583 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38584 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38585 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38586 ret_ref = (uintptr_t)ret_var.inner;
38587 if (ret_var.is_owned) {
38593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
38594 LDKNodeFeatures this_arg_conv;
38595 this_arg_conv.inner = (void*)(this_arg & (~1));
38596 this_arg_conv.is_owned = false;
38597 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38598 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
38602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
38603 LDKChannelFeatures ret_var = ChannelFeatures_empty();
38604 int64_t ret_ref = 0;
38605 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38606 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38607 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38608 ret_ref = (uintptr_t)ret_var.inner;
38609 if (ret_var.is_owned) {
38615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
38616 LDKChannelFeatures ret_var = ChannelFeatures_known();
38617 int64_t ret_ref = 0;
38618 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38619 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38620 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38621 ret_ref = (uintptr_t)ret_var.inner;
38622 if (ret_var.is_owned) {
38628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
38629 LDKChannelFeatures this_arg_conv;
38630 this_arg_conv.inner = (void*)(this_arg & (~1));
38631 this_arg_conv.is_owned = false;
38632 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38633 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
38637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
38638 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
38639 int64_t ret_ref = 0;
38640 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38641 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38642 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38643 ret_ref = (uintptr_t)ret_var.inner;
38644 if (ret_var.is_owned) {
38650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
38651 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
38652 int64_t ret_ref = 0;
38653 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38654 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38655 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38656 ret_ref = (uintptr_t)ret_var.inner;
38657 if (ret_var.is_owned) {
38663 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
38664 LDKInvoiceFeatures this_arg_conv;
38665 this_arg_conv.inner = (void*)(this_arg & (~1));
38666 this_arg_conv.is_owned = false;
38667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38668 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
38672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
38673 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
38674 int64_t ret_ref = 0;
38675 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38676 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38677 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38678 ret_ref = (uintptr_t)ret_var.inner;
38679 if (ret_var.is_owned) {
38685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) {
38686 LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
38687 int64_t ret_ref = 0;
38688 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38689 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38690 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38691 ret_ref = (uintptr_t)ret_var.inner;
38692 if (ret_var.is_owned) {
38698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
38699 LDKChannelTypeFeatures this_arg_conv;
38700 this_arg_conv.inner = (void*)(this_arg & (~1));
38701 this_arg_conv.is_owned = false;
38702 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38703 jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
38707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
38708 LDKInitFeatures obj_conv;
38709 obj_conv.inner = (void*)(obj & (~1));
38710 obj_conv.is_owned = false;
38711 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38712 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
38713 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38714 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38715 CVec_u8Z_free(ret_var);
38719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38720 LDKu8slice ser_ref;
38721 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38722 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38723 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
38724 *ret_conv = InitFeatures_read(ser_ref);
38725 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38726 return (int64_t)ret_conv;
38729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
38730 LDKChannelFeatures obj_conv;
38731 obj_conv.inner = (void*)(obj & (~1));
38732 obj_conv.is_owned = false;
38733 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38734 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
38735 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38736 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38737 CVec_u8Z_free(ret_var);
38741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38742 LDKu8slice ser_ref;
38743 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38744 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38745 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
38746 *ret_conv = ChannelFeatures_read(ser_ref);
38747 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38748 return (int64_t)ret_conv;
38751 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
38752 LDKNodeFeatures obj_conv;
38753 obj_conv.inner = (void*)(obj & (~1));
38754 obj_conv.is_owned = false;
38755 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38756 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
38757 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38758 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38759 CVec_u8Z_free(ret_var);
38763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38764 LDKu8slice ser_ref;
38765 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38766 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38767 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
38768 *ret_conv = NodeFeatures_read(ser_ref);
38769 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38770 return (int64_t)ret_conv;
38773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
38774 LDKInvoiceFeatures obj_conv;
38775 obj_conv.inner = (void*)(obj & (~1));
38776 obj_conv.is_owned = false;
38777 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38778 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
38779 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38780 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38781 CVec_u8Z_free(ret_var);
38785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38786 LDKu8slice ser_ref;
38787 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38788 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38789 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
38790 *ret_conv = InvoiceFeatures_read(ser_ref);
38791 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38792 return (int64_t)ret_conv;
38795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
38796 LDKChannelTypeFeatures obj_conv;
38797 obj_conv.inner = (void*)(obj & (~1));
38798 obj_conv.is_owned = false;
38799 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38800 LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
38801 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38802 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38803 CVec_u8Z_free(ret_var);
38807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38808 LDKu8slice ser_ref;
38809 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38810 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38811 LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
38812 *ret_conv = ChannelTypeFeatures_read(ser_ref);
38813 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38814 return (int64_t)ret_conv;
38817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38818 LDKShutdownScript this_obj_conv;
38819 this_obj_conv.inner = (void*)(this_obj & (~1));
38820 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38821 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38822 ShutdownScript_free(this_obj_conv);
38825 static inline uintptr_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
38826 LDKShutdownScript ret_var = ShutdownScript_clone(arg);
38827 int64_t ret_ref = 0;
38828 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38829 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38830 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38831 ret_ref = (uintptr_t)ret_var.inner;
38832 if (ret_var.is_owned) {
38837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38838 LDKShutdownScript arg_conv;
38839 arg_conv.inner = (void*)(arg & (~1));
38840 arg_conv.is_owned = false;
38841 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38842 int64_t ret_val = ShutdownScript_clone_ptr(&arg_conv);
38846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38847 LDKShutdownScript orig_conv;
38848 orig_conv.inner = (void*)(orig & (~1));
38849 orig_conv.is_owned = false;
38850 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38851 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
38852 int64_t ret_ref = 0;
38853 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38854 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38855 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38856 ret_ref = (uintptr_t)ret_var.inner;
38857 if (ret_var.is_owned) {
38863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
38864 LDKInvalidShutdownScript this_obj_conv;
38865 this_obj_conv.inner = (void*)(this_obj & (~1));
38866 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
38867 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38868 InvalidShutdownScript_free(this_obj_conv);
38871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
38872 LDKInvalidShutdownScript this_ptr_conv;
38873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38874 this_ptr_conv.is_owned = false;
38875 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38876 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
38877 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38878 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
38883 LDKInvalidShutdownScript this_ptr_conv;
38884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
38885 this_ptr_conv.is_owned = false;
38886 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38887 LDKCVec_u8Z val_ref;
38888 val_ref.datalen = (*env)->GetArrayLength(env, val);
38889 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38890 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
38891 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
38894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
38895 LDKCVec_u8Z script_arg_ref;
38896 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
38897 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38898 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
38899 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
38900 int64_t ret_ref = 0;
38901 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38902 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38903 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38904 ret_ref = (uintptr_t)ret_var.inner;
38905 if (ret_var.is_owned) {
38911 static inline uintptr_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
38912 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
38913 int64_t ret_ref = 0;
38914 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38915 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38916 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38917 ret_ref = (uintptr_t)ret_var.inner;
38918 if (ret_var.is_owned) {
38923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38924 LDKInvalidShutdownScript arg_conv;
38925 arg_conv.inner = (void*)(arg & (~1));
38926 arg_conv.is_owned = false;
38927 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38928 int64_t ret_val = InvalidShutdownScript_clone_ptr(&arg_conv);
38932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38933 LDKInvalidShutdownScript orig_conv;
38934 orig_conv.inner = (void*)(orig & (~1));
38935 orig_conv.is_owned = false;
38936 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38937 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
38938 int64_t ret_ref = 0;
38939 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38940 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38941 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38942 ret_ref = (uintptr_t)ret_var.inner;
38943 if (ret_var.is_owned) {
38949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
38950 LDKShutdownScript obj_conv;
38951 obj_conv.inner = (void*)(obj & (~1));
38952 obj_conv.is_owned = false;
38953 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38954 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
38955 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
38956 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
38957 CVec_u8Z_free(ret_var);
38961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
38962 LDKu8slice ser_ref;
38963 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
38964 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
38965 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
38966 *ret_conv = ShutdownScript_read(ser_ref);
38967 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
38968 return (int64_t)ret_conv;
38971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
38972 unsigned char pubkey_hash_arr[20];
38973 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
38974 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
38975 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
38976 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
38977 int64_t ret_ref = 0;
38978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38981 ret_ref = (uintptr_t)ret_var.inner;
38982 if (ret_var.is_owned) {
38988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
38989 unsigned char script_hash_arr[32];
38990 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
38991 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
38992 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
38993 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
38994 int64_t ret_ref = 0;
38995 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
38996 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
38997 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38998 ret_ref = (uintptr_t)ret_var.inner;
38999 if (ret_var.is_owned) {
39005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
39006 LDKu8slice program_ref;
39007 program_ref.datalen = (*env)->GetArrayLength(env, program);
39008 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
39009 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
39010 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
39011 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
39012 return (int64_t)ret_conv;
39015 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
39016 LDKShutdownScript this_arg_conv;
39017 this_arg_conv.inner = (void*)(this_arg & (~1));
39018 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
39019 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39020 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
39021 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
39022 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39023 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39024 CVec_u8Z_free(ret_var);
39028 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
39029 LDKShutdownScript this_arg_conv;
39030 this_arg_conv.inner = (void*)(this_arg & (~1));
39031 this_arg_conv.is_owned = false;
39032 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39033 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
39034 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
39038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
39039 LDKShutdownScript this_arg_conv;
39040 this_arg_conv.inner = (void*)(this_arg & (~1));
39041 this_arg_conv.is_owned = false;
39042 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39043 LDKInitFeatures features_conv;
39044 features_conv.inner = (void*)(features & (~1));
39045 features_conv.is_owned = false;
39046 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39047 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
39051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39052 if ((this_ptr & 1) != 0) return;
39053 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39054 CHECK_ACCESS(this_ptr_ptr);
39055 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
39056 FREE((void*)this_ptr);
39057 CustomMessageReader_free(this_ptr_conv);
39060 static inline uintptr_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
39061 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39062 *ret_ret = Type_clone(arg);
39063 return (int64_t)ret_ret;
39065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39066 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
39067 if (!(arg & 1)) { CHECK_ACCESS(arg_ptr); }
39068 LDKType* arg_conv = (LDKType*)arg_ptr;
39069 int64_t ret_val = Type_clone_ptr(arg_conv);
39073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39074 void* orig_ptr = (void*)(((uintptr_t)orig) & ~1);
39075 if (!(orig & 1)) { CHECK_ACCESS(orig_ptr); }
39076 LDKType* orig_conv = (LDKType*)orig_ptr;
39077 LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39078 *ret_ret = Type_clone(orig_conv);
39079 return (int64_t)ret_ret;
39082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39083 if ((this_ptr & 1) != 0) return;
39084 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39085 CHECK_ACCESS(this_ptr_ptr);
39086 LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
39087 FREE((void*)this_ptr);
39088 Type_free(this_ptr_conv);
39091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39092 LDKNodeId this_obj_conv;
39093 this_obj_conv.inner = (void*)(this_obj & (~1));
39094 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39095 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39096 NodeId_free(this_obj_conv);
39099 static inline uintptr_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
39100 LDKNodeId ret_var = NodeId_clone(arg);
39101 int64_t ret_ref = 0;
39102 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39103 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39104 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39105 ret_ref = (uintptr_t)ret_var.inner;
39106 if (ret_var.is_owned) {
39111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39112 LDKNodeId arg_conv;
39113 arg_conv.inner = (void*)(arg & (~1));
39114 arg_conv.is_owned = false;
39115 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39116 int64_t ret_val = NodeId_clone_ptr(&arg_conv);
39120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39121 LDKNodeId orig_conv;
39122 orig_conv.inner = (void*)(orig & (~1));
39123 orig_conv.is_owned = false;
39124 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39125 LDKNodeId ret_var = NodeId_clone(&orig_conv);
39126 int64_t ret_ref = 0;
39127 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39128 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39129 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39130 ret_ref = (uintptr_t)ret_var.inner;
39131 if (ret_var.is_owned) {
39137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
39138 LDKPublicKey pubkey_ref;
39139 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
39140 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
39141 LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
39142 int64_t ret_ref = 0;
39143 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39144 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39145 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39146 ret_ref = (uintptr_t)ret_var.inner;
39147 if (ret_var.is_owned) {
39153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
39154 LDKNodeId this_arg_conv;
39155 this_arg_conv.inner = (void*)(this_arg & (~1));
39156 this_arg_conv.is_owned = false;
39157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39158 LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
39159 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39160 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
39166 o_conv.inner = (void*)(o & (~1));
39167 o_conv.is_owned = false;
39168 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39169 int64_t ret_val = NodeId_hash(&o_conv);
39173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
39174 LDKNodeId obj_conv;
39175 obj_conv.inner = (void*)(obj & (~1));
39176 obj_conv.is_owned = false;
39177 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39178 LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
39179 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39180 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39181 CVec_u8Z_free(ret_var);
39185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39186 LDKu8slice ser_ref;
39187 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39188 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39189 LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
39190 *ret_conv = NodeId_read(ser_ref);
39191 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39192 return (int64_t)ret_conv;
39195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39196 LDKNetworkGraph this_obj_conv;
39197 this_obj_conv.inner = (void*)(this_obj & (~1));
39198 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39199 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39200 NetworkGraph_free(this_obj_conv);
39203 static inline uintptr_t NetworkGraph_clone_ptr(LDKNetworkGraph *NONNULL_PTR arg) {
39204 LDKNetworkGraph ret_var = NetworkGraph_clone(arg);
39205 int64_t ret_ref = 0;
39206 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39207 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39209 ret_ref = (uintptr_t)ret_var.inner;
39210 if (ret_var.is_owned) {
39215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39216 LDKNetworkGraph arg_conv;
39217 arg_conv.inner = (void*)(arg & (~1));
39218 arg_conv.is_owned = false;
39219 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39220 int64_t ret_val = NetworkGraph_clone_ptr(&arg_conv);
39224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39225 LDKNetworkGraph orig_conv;
39226 orig_conv.inner = (void*)(orig & (~1));
39227 orig_conv.is_owned = false;
39228 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39229 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
39230 int64_t ret_ref = 0;
39231 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39232 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39234 ret_ref = (uintptr_t)ret_var.inner;
39235 if (ret_var.is_owned) {
39241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39242 LDKReadOnlyNetworkGraph this_obj_conv;
39243 this_obj_conv.inner = (void*)(this_obj & (~1));
39244 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39245 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39246 ReadOnlyNetworkGraph_free(this_obj_conv);
39249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
39250 if ((this_ptr & 1) != 0) return;
39251 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
39252 CHECK_ACCESS(this_ptr_ptr);
39253 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
39254 FREE((void*)this_ptr);
39255 NetworkUpdate_free(this_ptr_conv);
39258 static inline uintptr_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
39259 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39260 *ret_copy = NetworkUpdate_clone(arg);
39261 int64_t ret_ref = (uintptr_t)ret_copy;
39264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39265 LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)arg;
39266 int64_t ret_val = NetworkUpdate_clone_ptr(arg_conv);
39270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39271 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
39272 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39273 *ret_copy = NetworkUpdate_clone(orig_conv);
39274 int64_t ret_ref = (uintptr_t)ret_copy;
39278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
39279 LDKChannelUpdate msg_conv;
39280 msg_conv.inner = (void*)(msg & (~1));
39281 msg_conv.is_owned = (msg & 1) || (msg == 0);
39282 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39283 msg_conv = ChannelUpdate_clone(&msg_conv);
39284 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39285 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
39286 int64_t ret_ref = (uintptr_t)ret_copy;
39290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
39291 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39292 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
39293 int64_t ret_ref = (uintptr_t)ret_copy;
39297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
39298 LDKPublicKey node_id_ref;
39299 CHECK((*env)->GetArrayLength(env, node_id) == 33);
39300 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
39301 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39302 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
39303 int64_t ret_ref = (uintptr_t)ret_copy;
39307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
39308 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
39309 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
39310 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39311 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39312 CVec_u8Z_free(ret_var);
39316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39317 LDKu8slice ser_ref;
39318 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39319 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39320 LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
39321 *ret_conv = NetworkUpdate_read(ser_ref);
39322 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39323 return (int64_t)ret_conv;
39326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
39327 LDKNetGraphMsgHandler this_arg_conv;
39328 this_arg_conv.inner = (void*)(this_arg & (~1));
39329 this_arg_conv.is_owned = false;
39330 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39331 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
39332 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
39333 return (int64_t)ret_ret;
39336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39337 LDKNetGraphMsgHandler this_obj_conv;
39338 this_obj_conv.inner = (void*)(this_obj & (~1));
39339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39340 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39341 NetGraphMsgHandler_free(this_obj_conv);
39344 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) {
39345 LDKNetworkGraph network_graph_conv;
39346 network_graph_conv.inner = (void*)(network_graph & (~1));
39347 network_graph_conv.is_owned = false;
39348 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
39349 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39350 CHECK_ACCESS(chain_access_ptr);
39351 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39352 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39353 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39354 // Manually implement clone for Java trait instances
39355 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39356 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39357 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39360 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
39361 CHECK_ACCESS(logger_ptr);
39362 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39363 if (logger_conv.free == LDKLogger_JCalls_free) {
39364 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39365 LDKLogger_JCalls_cloned(&logger_conv);
39367 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(&network_graph_conv, chain_access_conv, logger_conv);
39368 int64_t ret_ref = 0;
39369 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39370 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39371 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39372 ret_ref = (uintptr_t)ret_var.inner;
39373 if (ret_var.is_owned) {
39379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
39380 LDKNetGraphMsgHandler this_arg_conv;
39381 this_arg_conv.inner = (void*)(this_arg & (~1));
39382 this_arg_conv.is_owned = false;
39383 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39384 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
39385 CHECK_ACCESS(chain_access_ptr);
39386 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39387 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39388 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39389 // Manually implement clone for Java trait instances
39390 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39391 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39392 LDKAccess_JCalls_cloned(&chain_access_conv.some);
39395 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
39398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
39399 LDKNetGraphMsgHandler this_arg_conv;
39400 this_arg_conv.inner = (void*)(this_arg & (~1));
39401 this_arg_conv.is_owned = false;
39402 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39403 LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
39404 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
39405 return (int64_t)ret_ret;
39408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
39409 LDKNetGraphMsgHandler this_arg_conv;
39410 this_arg_conv.inner = (void*)(this_arg & (~1));
39411 this_arg_conv.is_owned = false;
39412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39413 LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
39414 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
39415 return (int64_t)ret_ret;
39418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39419 LDKChannelUpdateInfo this_obj_conv;
39420 this_obj_conv.inner = (void*)(this_obj & (~1));
39421 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39422 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39423 ChannelUpdateInfo_free(this_obj_conv);
39426 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
39427 LDKChannelUpdateInfo this_ptr_conv;
39428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39429 this_ptr_conv.is_owned = false;
39430 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39431 int32_t ret_val = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
39435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
39436 LDKChannelUpdateInfo this_ptr_conv;
39437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39438 this_ptr_conv.is_owned = false;
39439 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39440 ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
39443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
39444 LDKChannelUpdateInfo this_ptr_conv;
39445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39446 this_ptr_conv.is_owned = false;
39447 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39448 jboolean ret_val = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
39452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
39453 LDKChannelUpdateInfo this_ptr_conv;
39454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39455 this_ptr_conv.is_owned = false;
39456 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39457 ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
39460 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
39461 LDKChannelUpdateInfo this_ptr_conv;
39462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39463 this_ptr_conv.is_owned = false;
39464 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39465 int16_t ret_val = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
39469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
39470 LDKChannelUpdateInfo this_ptr_conv;
39471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39472 this_ptr_conv.is_owned = false;
39473 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39474 ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
39477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39478 LDKChannelUpdateInfo this_ptr_conv;
39479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39480 this_ptr_conv.is_owned = false;
39481 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39482 int64_t ret_val = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
39486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39487 LDKChannelUpdateInfo this_ptr_conv;
39488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39489 this_ptr_conv.is_owned = false;
39490 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39491 ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
39494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
39495 LDKChannelUpdateInfo this_ptr_conv;
39496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39497 this_ptr_conv.is_owned = false;
39498 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39499 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39500 *ret_copy = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
39501 int64_t ret_ref = (uintptr_t)ret_copy;
39505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39506 LDKChannelUpdateInfo this_ptr_conv;
39507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39508 this_ptr_conv.is_owned = false;
39509 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39510 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
39511 CHECK_ACCESS(val_ptr);
39512 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39513 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
39514 ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
39517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
39518 LDKChannelUpdateInfo this_ptr_conv;
39519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39520 this_ptr_conv.is_owned = false;
39521 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39522 LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
39523 int64_t ret_ref = 0;
39524 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39525 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39526 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39527 ret_ref = (uintptr_t)ret_var.inner;
39528 if (ret_var.is_owned) {
39534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39535 LDKChannelUpdateInfo this_ptr_conv;
39536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39537 this_ptr_conv.is_owned = false;
39538 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39539 LDKRoutingFees val_conv;
39540 val_conv.inner = (void*)(val & (~1));
39541 val_conv.is_owned = (val & 1) || (val == 0);
39542 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39543 val_conv = RoutingFees_clone(&val_conv);
39544 ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
39547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
39548 LDKChannelUpdateInfo this_ptr_conv;
39549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39550 this_ptr_conv.is_owned = false;
39551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39552 LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
39553 int64_t ret_ref = 0;
39554 if ((uintptr_t)ret_var.inner > 4096) {
39555 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39556 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39557 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39558 ret_ref = (uintptr_t)ret_var.inner;
39559 if (ret_var.is_owned) {
39566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39567 LDKChannelUpdateInfo this_ptr_conv;
39568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39569 this_ptr_conv.is_owned = false;
39570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39571 LDKChannelUpdate val_conv;
39572 val_conv.inner = (void*)(val & (~1));
39573 val_conv.is_owned = (val & 1) || (val == 0);
39574 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39575 val_conv = ChannelUpdate_clone(&val_conv);
39576 ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
39579 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) {
39580 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
39581 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
39582 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
39583 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
39584 LDKRoutingFees fees_arg_conv;
39585 fees_arg_conv.inner = (void*)(fees_arg & (~1));
39586 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
39587 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
39588 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
39589 LDKChannelUpdate last_update_message_arg_conv;
39590 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
39591 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
39592 CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
39593 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
39594 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);
39595 int64_t ret_ref = 0;
39596 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39597 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39599 ret_ref = (uintptr_t)ret_var.inner;
39600 if (ret_var.is_owned) {
39606 static inline uintptr_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
39607 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
39608 int64_t ret_ref = 0;
39609 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39610 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39611 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39612 ret_ref = (uintptr_t)ret_var.inner;
39613 if (ret_var.is_owned) {
39618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39619 LDKChannelUpdateInfo arg_conv;
39620 arg_conv.inner = (void*)(arg & (~1));
39621 arg_conv.is_owned = false;
39622 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39623 int64_t ret_val = ChannelUpdateInfo_clone_ptr(&arg_conv);
39627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39628 LDKChannelUpdateInfo orig_conv;
39629 orig_conv.inner = (void*)(orig & (~1));
39630 orig_conv.is_owned = false;
39631 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39632 LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
39633 int64_t ret_ref = 0;
39634 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39635 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39636 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39637 ret_ref = (uintptr_t)ret_var.inner;
39638 if (ret_var.is_owned) {
39644 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
39645 LDKChannelUpdateInfo obj_conv;
39646 obj_conv.inner = (void*)(obj & (~1));
39647 obj_conv.is_owned = false;
39648 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39649 LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
39650 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39651 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39652 CVec_u8Z_free(ret_var);
39656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39657 LDKu8slice ser_ref;
39658 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39659 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39660 LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
39661 *ret_conv = ChannelUpdateInfo_read(ser_ref);
39662 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39663 return (int64_t)ret_conv;
39666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39667 LDKChannelInfo this_obj_conv;
39668 this_obj_conv.inner = (void*)(this_obj & (~1));
39669 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39670 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39671 ChannelInfo_free(this_obj_conv);
39674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
39675 LDKChannelInfo this_ptr_conv;
39676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39677 this_ptr_conv.is_owned = false;
39678 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39679 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
39680 int64_t ret_ref = 0;
39681 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39682 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39683 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39684 ret_ref = (uintptr_t)ret_var.inner;
39685 if (ret_var.is_owned) {
39691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39692 LDKChannelInfo this_ptr_conv;
39693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39694 this_ptr_conv.is_owned = false;
39695 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39696 LDKChannelFeatures val_conv;
39697 val_conv.inner = (void*)(val & (~1));
39698 val_conv.is_owned = (val & 1) || (val == 0);
39699 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39700 val_conv = ChannelFeatures_clone(&val_conv);
39701 ChannelInfo_set_features(&this_ptr_conv, val_conv);
39704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
39705 LDKChannelInfo this_ptr_conv;
39706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39707 this_ptr_conv.is_owned = false;
39708 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39709 LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
39710 int64_t ret_ref = 0;
39711 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39712 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39713 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39714 ret_ref = (uintptr_t)ret_var.inner;
39715 if (ret_var.is_owned) {
39721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39722 LDKChannelInfo this_ptr_conv;
39723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39724 this_ptr_conv.is_owned = false;
39725 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39726 LDKNodeId val_conv;
39727 val_conv.inner = (void*)(val & (~1));
39728 val_conv.is_owned = (val & 1) || (val == 0);
39729 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39730 val_conv = NodeId_clone(&val_conv);
39731 ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
39734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
39735 LDKChannelInfo this_ptr_conv;
39736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39737 this_ptr_conv.is_owned = false;
39738 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39739 LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
39740 int64_t ret_ref = 0;
39741 if ((uintptr_t)ret_var.inner > 4096) {
39742 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39743 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39744 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39745 ret_ref = (uintptr_t)ret_var.inner;
39746 if (ret_var.is_owned) {
39753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39754 LDKChannelInfo this_ptr_conv;
39755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39756 this_ptr_conv.is_owned = false;
39757 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39758 LDKChannelUpdateInfo val_conv;
39759 val_conv.inner = (void*)(val & (~1));
39760 val_conv.is_owned = (val & 1) || (val == 0);
39761 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39762 val_conv = ChannelUpdateInfo_clone(&val_conv);
39763 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
39766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
39767 LDKChannelInfo this_ptr_conv;
39768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39769 this_ptr_conv.is_owned = false;
39770 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39771 LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
39772 int64_t ret_ref = 0;
39773 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39774 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39775 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39776 ret_ref = (uintptr_t)ret_var.inner;
39777 if (ret_var.is_owned) {
39783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39784 LDKChannelInfo this_ptr_conv;
39785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39786 this_ptr_conv.is_owned = false;
39787 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39788 LDKNodeId val_conv;
39789 val_conv.inner = (void*)(val & (~1));
39790 val_conv.is_owned = (val & 1) || (val == 0);
39791 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39792 val_conv = NodeId_clone(&val_conv);
39793 ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
39796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
39797 LDKChannelInfo this_ptr_conv;
39798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39799 this_ptr_conv.is_owned = false;
39800 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39801 LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
39802 int64_t ret_ref = 0;
39803 if ((uintptr_t)ret_var.inner > 4096) {
39804 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39805 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39806 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39807 ret_ref = (uintptr_t)ret_var.inner;
39808 if (ret_var.is_owned) {
39815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39816 LDKChannelInfo this_ptr_conv;
39817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39818 this_ptr_conv.is_owned = false;
39819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39820 LDKChannelUpdateInfo val_conv;
39821 val_conv.inner = (void*)(val & (~1));
39822 val_conv.is_owned = (val & 1) || (val == 0);
39823 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39824 val_conv = ChannelUpdateInfo_clone(&val_conv);
39825 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
39828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
39829 LDKChannelInfo this_ptr_conv;
39830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39831 this_ptr_conv.is_owned = false;
39832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39833 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39834 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
39835 int64_t ret_ref = (uintptr_t)ret_copy;
39839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39840 LDKChannelInfo this_ptr_conv;
39841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39842 this_ptr_conv.is_owned = false;
39843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39844 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
39845 CHECK_ACCESS(val_ptr);
39846 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39847 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
39848 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
39851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
39852 LDKChannelInfo this_ptr_conv;
39853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39854 this_ptr_conv.is_owned = false;
39855 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39856 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
39857 int64_t ret_ref = 0;
39858 if ((uintptr_t)ret_var.inner > 4096) {
39859 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39860 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39861 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39862 ret_ref = (uintptr_t)ret_var.inner;
39863 if (ret_var.is_owned) {
39870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
39871 LDKChannelInfo this_ptr_conv;
39872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
39873 this_ptr_conv.is_owned = false;
39874 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39875 LDKChannelAnnouncement val_conv;
39876 val_conv.inner = (void*)(val & (~1));
39877 val_conv.is_owned = (val & 1) || (val == 0);
39878 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39879 val_conv = ChannelAnnouncement_clone(&val_conv);
39880 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
39883 static inline uintptr_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
39884 LDKChannelInfo ret_var = ChannelInfo_clone(arg);
39885 int64_t ret_ref = 0;
39886 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39887 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39888 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39889 ret_ref = (uintptr_t)ret_var.inner;
39890 if (ret_var.is_owned) {
39895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39896 LDKChannelInfo arg_conv;
39897 arg_conv.inner = (void*)(arg & (~1));
39898 arg_conv.is_owned = false;
39899 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39900 int64_t ret_val = ChannelInfo_clone_ptr(&arg_conv);
39904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39905 LDKChannelInfo orig_conv;
39906 orig_conv.inner = (void*)(orig & (~1));
39907 orig_conv.is_owned = false;
39908 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39909 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
39910 int64_t ret_ref = 0;
39911 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39912 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39913 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39914 ret_ref = (uintptr_t)ret_var.inner;
39915 if (ret_var.is_owned) {
39921 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
39922 LDKChannelInfo obj_conv;
39923 obj_conv.inner = (void*)(obj & (~1));
39924 obj_conv.is_owned = false;
39925 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39926 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
39927 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
39928 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
39929 CVec_u8Z_free(ret_var);
39933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
39934 LDKu8slice ser_ref;
39935 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
39936 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
39937 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
39938 *ret_conv = ChannelInfo_read(ser_ref);
39939 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
39940 return (int64_t)ret_conv;
39943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
39944 LDKDirectedChannelInfo this_obj_conv;
39945 this_obj_conv.inner = (void*)(this_obj & (~1));
39946 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
39947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39948 DirectedChannelInfo_free(this_obj_conv);
39951 static inline uintptr_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
39952 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
39953 int64_t ret_ref = 0;
39954 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39955 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39956 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39957 ret_ref = (uintptr_t)ret_var.inner;
39958 if (ret_var.is_owned) {
39963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39964 LDKDirectedChannelInfo arg_conv;
39965 arg_conv.inner = (void*)(arg & (~1));
39966 arg_conv.is_owned = false;
39967 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39968 int64_t ret_val = DirectedChannelInfo_clone_ptr(&arg_conv);
39972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39973 LDKDirectedChannelInfo orig_conv;
39974 orig_conv.inner = (void*)(orig & (~1));
39975 orig_conv.is_owned = false;
39976 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39977 LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
39978 int64_t ret_ref = 0;
39979 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39980 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39981 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39982 ret_ref = (uintptr_t)ret_var.inner;
39983 if (ret_var.is_owned) {
39989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
39990 LDKDirectedChannelInfo this_arg_conv;
39991 this_arg_conv.inner = (void*)(this_arg & (~1));
39992 this_arg_conv.is_owned = false;
39993 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39994 LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
39995 int64_t ret_ref = 0;
39996 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
39997 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
39998 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39999 ret_ref = (uintptr_t)ret_var.inner;
40000 if (ret_var.is_owned) {
40006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1direction(JNIEnv *env, jclass clz, int64_t this_arg) {
40007 LDKDirectedChannelInfo this_arg_conv;
40008 this_arg_conv.inner = (void*)(this_arg & (~1));
40009 this_arg_conv.is_owned = false;
40010 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40011 LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
40012 int64_t ret_ref = 0;
40013 if ((uintptr_t)ret_var.inner > 4096) {
40014 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40015 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40016 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40017 ret_ref = (uintptr_t)ret_var.inner;
40018 if (ret_var.is_owned) {
40025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
40026 LDKDirectedChannelInfo this_arg_conv;
40027 this_arg_conv.inner = (void*)(this_arg & (~1));
40028 this_arg_conv.is_owned = false;
40029 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40030 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40031 *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
40032 int64_t ret_ref = (uintptr_t)ret_copy;
40036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40037 if ((this_ptr & 1) != 0) return;
40038 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
40039 CHECK_ACCESS(this_ptr_ptr);
40040 LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
40041 FREE((void*)this_ptr);
40042 EffectiveCapacity_free(this_ptr_conv);
40045 static inline uintptr_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
40046 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40047 *ret_copy = EffectiveCapacity_clone(arg);
40048 int64_t ret_ref = (uintptr_t)ret_copy;
40051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40052 LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)arg;
40053 int64_t ret_val = EffectiveCapacity_clone_ptr(arg_conv);
40057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40058 LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)orig;
40059 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40060 *ret_copy = EffectiveCapacity_clone(orig_conv);
40061 int64_t ret_ref = (uintptr_t)ret_copy;
40065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
40066 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40067 *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
40068 int64_t ret_ref = (uintptr_t)ret_copy;
40072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1maximum_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
40073 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40074 *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
40075 int64_t ret_ref = (uintptr_t)ret_copy;
40079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat) {
40080 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40081 *ret_copy = EffectiveCapacity_total(capacity_msat);
40082 int64_t ret_ref = (uintptr_t)ret_copy;
40086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
40087 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40088 *ret_copy = EffectiveCapacity_infinite();
40089 int64_t ret_ref = (uintptr_t)ret_copy;
40093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
40094 LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40095 *ret_copy = EffectiveCapacity_unknown();
40096 int64_t ret_ref = (uintptr_t)ret_copy;
40100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
40101 LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)this_arg;
40102 int64_t ret_val = EffectiveCapacity_as_msat(this_arg_conv);
40106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40107 LDKRoutingFees this_obj_conv;
40108 this_obj_conv.inner = (void*)(this_obj & (~1));
40109 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40110 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40111 RoutingFees_free(this_obj_conv);
40114 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
40115 LDKRoutingFees this_ptr_conv;
40116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40117 this_ptr_conv.is_owned = false;
40118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40119 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
40123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40124 LDKRoutingFees this_ptr_conv;
40125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40126 this_ptr_conv.is_owned = false;
40127 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40128 RoutingFees_set_base_msat(&this_ptr_conv, val);
40131 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
40132 LDKRoutingFees this_ptr_conv;
40133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40134 this_ptr_conv.is_owned = false;
40135 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40136 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
40140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40141 LDKRoutingFees this_ptr_conv;
40142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40143 this_ptr_conv.is_owned = false;
40144 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40145 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
40148 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) {
40149 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
40150 int64_t ret_ref = 0;
40151 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40152 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40154 ret_ref = (uintptr_t)ret_var.inner;
40155 if (ret_var.is_owned) {
40161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40162 LDKRoutingFees a_conv;
40163 a_conv.inner = (void*)(a & (~1));
40164 a_conv.is_owned = false;
40165 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40166 LDKRoutingFees b_conv;
40167 b_conv.inner = (void*)(b & (~1));
40168 b_conv.is_owned = false;
40169 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40170 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
40174 static inline uintptr_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
40175 LDKRoutingFees ret_var = RoutingFees_clone(arg);
40176 int64_t ret_ref = 0;
40177 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40178 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40179 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40180 ret_ref = (uintptr_t)ret_var.inner;
40181 if (ret_var.is_owned) {
40186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40187 LDKRoutingFees arg_conv;
40188 arg_conv.inner = (void*)(arg & (~1));
40189 arg_conv.is_owned = false;
40190 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40191 int64_t ret_val = RoutingFees_clone_ptr(&arg_conv);
40195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40196 LDKRoutingFees orig_conv;
40197 orig_conv.inner = (void*)(orig & (~1));
40198 orig_conv.is_owned = false;
40199 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40200 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
40201 int64_t ret_ref = 0;
40202 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40203 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40204 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40205 ret_ref = (uintptr_t)ret_var.inner;
40206 if (ret_var.is_owned) {
40212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
40213 LDKRoutingFees o_conv;
40214 o_conv.inner = (void*)(o & (~1));
40215 o_conv.is_owned = false;
40216 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40217 int64_t ret_val = RoutingFees_hash(&o_conv);
40221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
40222 LDKRoutingFees obj_conv;
40223 obj_conv.inner = (void*)(obj & (~1));
40224 obj_conv.is_owned = false;
40225 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40226 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
40227 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40228 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40229 CVec_u8Z_free(ret_var);
40233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40234 LDKu8slice ser_ref;
40235 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40236 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40237 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
40238 *ret_conv = RoutingFees_read(ser_ref);
40239 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40240 return (int64_t)ret_conv;
40243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40244 LDKNodeAnnouncementInfo this_obj_conv;
40245 this_obj_conv.inner = (void*)(this_obj & (~1));
40246 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40247 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40248 NodeAnnouncementInfo_free(this_obj_conv);
40251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
40252 LDKNodeAnnouncementInfo this_ptr_conv;
40253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40254 this_ptr_conv.is_owned = false;
40255 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40256 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
40257 int64_t ret_ref = 0;
40258 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40259 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40260 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40261 ret_ref = (uintptr_t)ret_var.inner;
40262 if (ret_var.is_owned) {
40268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40269 LDKNodeAnnouncementInfo this_ptr_conv;
40270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40271 this_ptr_conv.is_owned = false;
40272 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40273 LDKNodeFeatures val_conv;
40274 val_conv.inner = (void*)(val & (~1));
40275 val_conv.is_owned = (val & 1) || (val == 0);
40276 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40277 val_conv = NodeFeatures_clone(&val_conv);
40278 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
40281 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
40282 LDKNodeAnnouncementInfo this_ptr_conv;
40283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40284 this_ptr_conv.is_owned = false;
40285 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40286 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
40290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
40291 LDKNodeAnnouncementInfo 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 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
40298 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
40299 LDKNodeAnnouncementInfo this_ptr_conv;
40300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40301 this_ptr_conv.is_owned = false;
40302 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40303 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
40304 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
40308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40309 LDKNodeAnnouncementInfo this_ptr_conv;
40310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40311 this_ptr_conv.is_owned = false;
40312 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40313 LDKThreeBytes val_ref;
40314 CHECK((*env)->GetArrayLength(env, val) == 3);
40315 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
40316 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
40319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
40320 LDKNodeAnnouncementInfo this_ptr_conv;
40321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40322 this_ptr_conv.is_owned = false;
40323 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40324 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
40325 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
40329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40330 LDKNodeAnnouncementInfo this_ptr_conv;
40331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40332 this_ptr_conv.is_owned = false;
40333 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40334 LDKThirtyTwoBytes val_ref;
40335 CHECK((*env)->GetArrayLength(env, val) == 32);
40336 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
40337 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
40340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40341 LDKNodeAnnouncementInfo this_ptr_conv;
40342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40343 this_ptr_conv.is_owned = false;
40344 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40345 LDKCVec_NetAddressZ val_constr;
40346 val_constr.datalen = (*env)->GetArrayLength(env, val);
40347 if (val_constr.datalen > 0)
40348 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40350 val_constr.data = NULL;
40351 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40352 for (size_t m = 0; m < val_constr.datalen; m++) {
40353 int64_t val_conv_12 = val_vals[m];
40354 void* val_conv_12_ptr = (void*)(((uintptr_t)val_conv_12) & ~1);
40355 CHECK_ACCESS(val_conv_12_ptr);
40356 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
40357 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)val_conv_12) & ~1));
40358 val_constr.data[m] = val_conv_12_conv;
40360 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40361 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
40364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
40365 LDKNodeAnnouncementInfo this_ptr_conv;
40366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40367 this_ptr_conv.is_owned = false;
40368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40369 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
40370 int64_t ret_ref = 0;
40371 if ((uintptr_t)ret_var.inner > 4096) {
40372 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40373 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40374 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40375 ret_ref = (uintptr_t)ret_var.inner;
40376 if (ret_var.is_owned) {
40383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40384 LDKNodeAnnouncementInfo this_ptr_conv;
40385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40386 this_ptr_conv.is_owned = false;
40387 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40388 LDKNodeAnnouncement val_conv;
40389 val_conv.inner = (void*)(val & (~1));
40390 val_conv.is_owned = (val & 1) || (val == 0);
40391 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40392 val_conv = NodeAnnouncement_clone(&val_conv);
40393 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
40396 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) {
40397 LDKNodeFeatures features_arg_conv;
40398 features_arg_conv.inner = (void*)(features_arg & (~1));
40399 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
40400 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40401 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
40402 LDKThreeBytes rgb_arg_ref;
40403 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
40404 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
40405 LDKThirtyTwoBytes alias_arg_ref;
40406 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
40407 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
40408 LDKCVec_NetAddressZ addresses_arg_constr;
40409 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
40410 if (addresses_arg_constr.datalen > 0)
40411 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40413 addresses_arg_constr.data = NULL;
40414 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
40415 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
40416 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
40417 void* addresses_arg_conv_12_ptr = (void*)(((uintptr_t)addresses_arg_conv_12) & ~1);
40418 CHECK_ACCESS(addresses_arg_conv_12_ptr);
40419 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
40420 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
40422 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
40423 LDKNodeAnnouncement announcement_message_arg_conv;
40424 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
40425 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
40426 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
40427 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
40428 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
40429 int64_t ret_ref = 0;
40430 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40431 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40432 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40433 ret_ref = (uintptr_t)ret_var.inner;
40434 if (ret_var.is_owned) {
40440 static inline uintptr_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
40441 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
40442 int64_t ret_ref = 0;
40443 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40444 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40445 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40446 ret_ref = (uintptr_t)ret_var.inner;
40447 if (ret_var.is_owned) {
40452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40453 LDKNodeAnnouncementInfo arg_conv;
40454 arg_conv.inner = (void*)(arg & (~1));
40455 arg_conv.is_owned = false;
40456 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40457 int64_t ret_val = NodeAnnouncementInfo_clone_ptr(&arg_conv);
40461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40462 LDKNodeAnnouncementInfo orig_conv;
40463 orig_conv.inner = (void*)(orig & (~1));
40464 orig_conv.is_owned = false;
40465 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40466 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
40467 int64_t ret_ref = 0;
40468 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40469 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40470 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40471 ret_ref = (uintptr_t)ret_var.inner;
40472 if (ret_var.is_owned) {
40478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
40479 LDKNodeAnnouncementInfo obj_conv;
40480 obj_conv.inner = (void*)(obj & (~1));
40481 obj_conv.is_owned = false;
40482 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40483 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
40484 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40485 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40486 CVec_u8Z_free(ret_var);
40490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40491 LDKu8slice ser_ref;
40492 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40493 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40494 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
40495 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
40496 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40497 return (int64_t)ret_conv;
40500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40501 LDKNodeInfo this_obj_conv;
40502 this_obj_conv.inner = (void*)(this_obj & (~1));
40503 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40504 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40505 NodeInfo_free(this_obj_conv);
40508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
40509 LDKNodeInfo this_ptr_conv;
40510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40511 this_ptr_conv.is_owned = false;
40512 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40513 LDKCVec_u64Z val_constr;
40514 val_constr.datalen = (*env)->GetArrayLength(env, val);
40515 if (val_constr.datalen > 0)
40516 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40518 val_constr.data = NULL;
40519 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
40520 for (size_t g = 0; g < val_constr.datalen; g++) {
40521 int64_t val_conv_6 = val_vals[g];
40522 val_constr.data[g] = val_conv_6;
40524 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
40525 NodeInfo_set_channels(&this_ptr_conv, val_constr);
40528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
40529 LDKNodeInfo this_ptr_conv;
40530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40531 this_ptr_conv.is_owned = false;
40532 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40533 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
40534 int64_t ret_ref = 0;
40535 if ((uintptr_t)ret_var.inner > 4096) {
40536 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40537 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40538 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40539 ret_ref = (uintptr_t)ret_var.inner;
40540 if (ret_var.is_owned) {
40547 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) {
40548 LDKNodeInfo this_ptr_conv;
40549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40550 this_ptr_conv.is_owned = false;
40551 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40552 LDKRoutingFees val_conv;
40553 val_conv.inner = (void*)(val & (~1));
40554 val_conv.is_owned = (val & 1) || (val == 0);
40555 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40556 val_conv = RoutingFees_clone(&val_conv);
40557 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
40560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
40561 LDKNodeInfo this_ptr_conv;
40562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40563 this_ptr_conv.is_owned = false;
40564 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40565 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
40566 int64_t ret_ref = 0;
40567 if ((uintptr_t)ret_var.inner > 4096) {
40568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40571 ret_ref = (uintptr_t)ret_var.inner;
40572 if (ret_var.is_owned) {
40579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40580 LDKNodeInfo this_ptr_conv;
40581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40582 this_ptr_conv.is_owned = false;
40583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40584 LDKNodeAnnouncementInfo val_conv;
40585 val_conv.inner = (void*)(val & (~1));
40586 val_conv.is_owned = (val & 1) || (val == 0);
40587 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40588 val_conv = NodeAnnouncementInfo_clone(&val_conv);
40589 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
40592 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) {
40593 LDKCVec_u64Z channels_arg_constr;
40594 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
40595 if (channels_arg_constr.datalen > 0)
40596 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40598 channels_arg_constr.data = NULL;
40599 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
40600 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
40601 int64_t channels_arg_conv_6 = channels_arg_vals[g];
40602 channels_arg_constr.data[g] = channels_arg_conv_6;
40604 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
40605 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
40606 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
40607 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
40608 CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
40609 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
40610 LDKNodeAnnouncementInfo announcement_info_arg_conv;
40611 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
40612 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
40613 CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
40614 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
40615 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
40616 int64_t ret_ref = 0;
40617 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40618 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40619 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40620 ret_ref = (uintptr_t)ret_var.inner;
40621 if (ret_var.is_owned) {
40627 static inline uintptr_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
40628 LDKNodeInfo ret_var = NodeInfo_clone(arg);
40629 int64_t ret_ref = 0;
40630 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40631 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40632 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40633 ret_ref = (uintptr_t)ret_var.inner;
40634 if (ret_var.is_owned) {
40639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40640 LDKNodeInfo arg_conv;
40641 arg_conv.inner = (void*)(arg & (~1));
40642 arg_conv.is_owned = false;
40643 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40644 int64_t ret_val = NodeInfo_clone_ptr(&arg_conv);
40648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40649 LDKNodeInfo orig_conv;
40650 orig_conv.inner = (void*)(orig & (~1));
40651 orig_conv.is_owned = false;
40652 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40653 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
40654 int64_t ret_ref = 0;
40655 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40656 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40657 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40658 ret_ref = (uintptr_t)ret_var.inner;
40659 if (ret_var.is_owned) {
40665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
40666 LDKNodeInfo obj_conv;
40667 obj_conv.inner = (void*)(obj & (~1));
40668 obj_conv.is_owned = false;
40669 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40670 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
40671 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40672 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40673 CVec_u8Z_free(ret_var);
40677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40678 LDKu8slice ser_ref;
40679 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40680 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40681 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
40682 *ret_conv = NodeInfo_read(ser_ref);
40683 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40684 return (int64_t)ret_conv;
40687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
40688 LDKNetworkGraph obj_conv;
40689 obj_conv.inner = (void*)(obj & (~1));
40690 obj_conv.is_owned = false;
40691 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40692 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
40693 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40694 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40695 CVec_u8Z_free(ret_var);
40699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40700 LDKu8slice ser_ref;
40701 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40702 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40703 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
40704 *ret_conv = NetworkGraph_read(ser_ref);
40705 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40706 return (int64_t)ret_conv;
40709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
40710 LDKThirtyTwoBytes genesis_hash_ref;
40711 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
40712 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
40713 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
40714 int64_t ret_ref = 0;
40715 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40716 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40718 ret_ref = (uintptr_t)ret_var.inner;
40719 if (ret_var.is_owned) {
40725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
40726 LDKNetworkGraph this_arg_conv;
40727 this_arg_conv.inner = (void*)(this_arg & (~1));
40728 this_arg_conv.is_owned = false;
40729 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40730 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
40731 int64_t ret_ref = 0;
40732 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40733 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40734 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40735 ret_ref = (uintptr_t)ret_var.inner;
40736 if (ret_var.is_owned) {
40742 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) {
40743 LDKNetworkGraph this_arg_conv;
40744 this_arg_conv.inner = (void*)(this_arg & (~1));
40745 this_arg_conv.is_owned = false;
40746 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40747 LDKNodeAnnouncement msg_conv;
40748 msg_conv.inner = (void*)(msg & (~1));
40749 msg_conv.is_owned = false;
40750 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40751 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40752 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
40753 return (int64_t)ret_conv;
40756 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) {
40757 LDKNetworkGraph this_arg_conv;
40758 this_arg_conv.inner = (void*)(this_arg & (~1));
40759 this_arg_conv.is_owned = false;
40760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40761 LDKUnsignedNodeAnnouncement msg_conv;
40762 msg_conv.inner = (void*)(msg & (~1));
40763 msg_conv.is_owned = false;
40764 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40765 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40766 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
40767 return (int64_t)ret_conv;
40770 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) {
40771 LDKNetworkGraph this_arg_conv;
40772 this_arg_conv.inner = (void*)(this_arg & (~1));
40773 this_arg_conv.is_owned = false;
40774 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40775 LDKChannelAnnouncement msg_conv;
40776 msg_conv.inner = (void*)(msg & (~1));
40777 msg_conv.is_owned = false;
40778 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40779 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
40780 CHECK_ACCESS(chain_access_ptr);
40781 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40782 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40783 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40784 // Manually implement clone for Java trait instances
40785 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40786 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40787 LDKAccess_JCalls_cloned(&chain_access_conv.some);
40790 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40791 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
40792 return (int64_t)ret_conv;
40795 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) {
40796 LDKNetworkGraph this_arg_conv;
40797 this_arg_conv.inner = (void*)(this_arg & (~1));
40798 this_arg_conv.is_owned = false;
40799 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40800 LDKUnsignedChannelAnnouncement msg_conv;
40801 msg_conv.inner = (void*)(msg & (~1));
40802 msg_conv.is_owned = false;
40803 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40804 void* chain_access_ptr = (void*)(((uintptr_t)chain_access) & ~1);
40805 CHECK_ACCESS(chain_access_ptr);
40806 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40807 // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40808 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40809 // Manually implement clone for Java trait instances
40810 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
40811 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40812 LDKAccess_JCalls_cloned(&chain_access_conv.some);
40815 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40816 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
40817 return (int64_t)ret_conv;
40820 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) {
40821 LDKNetworkGraph this_arg_conv;
40822 this_arg_conv.inner = (void*)(this_arg & (~1));
40823 this_arg_conv.is_owned = false;
40824 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40825 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
40828 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) {
40829 LDKNetworkGraph this_arg_conv;
40830 this_arg_conv.inner = (void*)(this_arg & (~1));
40831 this_arg_conv.is_owned = false;
40832 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40833 LDKPublicKey _node_id_ref;
40834 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
40835 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
40836 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
40839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
40840 LDKNetworkGraph this_arg_conv;
40841 this_arg_conv.inner = (void*)(this_arg & (~1));
40842 this_arg_conv.is_owned = false;
40843 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40844 NetworkGraph_remove_stale_channels(&this_arg_conv);
40847 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) {
40848 LDKNetworkGraph this_arg_conv;
40849 this_arg_conv.inner = (void*)(this_arg & (~1));
40850 this_arg_conv.is_owned = false;
40851 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40852 NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
40855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
40856 LDKNetworkGraph this_arg_conv;
40857 this_arg_conv.inner = (void*)(this_arg & (~1));
40858 this_arg_conv.is_owned = false;
40859 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40860 LDKChannelUpdate msg_conv;
40861 msg_conv.inner = (void*)(msg & (~1));
40862 msg_conv.is_owned = false;
40863 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40864 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40865 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
40866 return (int64_t)ret_conv;
40869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
40870 LDKNetworkGraph this_arg_conv;
40871 this_arg_conv.inner = (void*)(this_arg & (~1));
40872 this_arg_conv.is_owned = false;
40873 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40874 LDKUnsignedChannelUpdate msg_conv;
40875 msg_conv.inner = (void*)(msg & (~1));
40876 msg_conv.is_owned = false;
40877 CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40878 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40879 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
40880 return (int64_t)ret_conv;
40883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
40884 LDKReadOnlyNetworkGraph this_arg_conv;
40885 this_arg_conv.inner = (void*)(this_arg & (~1));
40886 this_arg_conv.is_owned = false;
40887 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40888 LDKPublicKey pubkey_ref;
40889 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
40890 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
40891 LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
40892 *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
40893 int64_t ret_ref = (uintptr_t)ret_copy;
40897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40898 LDKRouteHop this_obj_conv;
40899 this_obj_conv.inner = (void*)(this_obj & (~1));
40900 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
40901 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40902 RouteHop_free(this_obj_conv);
40905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
40906 LDKRouteHop this_ptr_conv;
40907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40908 this_ptr_conv.is_owned = false;
40909 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40910 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
40911 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
40915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
40916 LDKRouteHop this_ptr_conv;
40917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40918 this_ptr_conv.is_owned = false;
40919 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40920 LDKPublicKey val_ref;
40921 CHECK((*env)->GetArrayLength(env, val) == 33);
40922 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
40923 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
40926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
40927 LDKRouteHop this_ptr_conv;
40928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40929 this_ptr_conv.is_owned = false;
40930 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40931 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
40932 int64_t ret_ref = 0;
40933 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40934 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40935 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40936 ret_ref = (uintptr_t)ret_var.inner;
40937 if (ret_var.is_owned) {
40943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40944 LDKRouteHop this_ptr_conv;
40945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40946 this_ptr_conv.is_owned = false;
40947 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40948 LDKNodeFeatures val_conv;
40949 val_conv.inner = (void*)(val & (~1));
40950 val_conv.is_owned = (val & 1) || (val == 0);
40951 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40952 val_conv = NodeFeatures_clone(&val_conv);
40953 RouteHop_set_node_features(&this_ptr_conv, val_conv);
40956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
40957 LDKRouteHop this_ptr_conv;
40958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40959 this_ptr_conv.is_owned = false;
40960 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40961 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
40965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40966 LDKRouteHop this_ptr_conv;
40967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40968 this_ptr_conv.is_owned = false;
40969 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40970 RouteHop_set_short_channel_id(&this_ptr_conv, val);
40973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
40974 LDKRouteHop this_ptr_conv;
40975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40976 this_ptr_conv.is_owned = false;
40977 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40978 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
40979 int64_t ret_ref = 0;
40980 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
40981 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
40982 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40983 ret_ref = (uintptr_t)ret_var.inner;
40984 if (ret_var.is_owned) {
40990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40991 LDKRouteHop this_ptr_conv;
40992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
40993 this_ptr_conv.is_owned = false;
40994 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40995 LDKChannelFeatures val_conv;
40996 val_conv.inner = (void*)(val & (~1));
40997 val_conv.is_owned = (val & 1) || (val == 0);
40998 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40999 val_conv = ChannelFeatures_clone(&val_conv);
41000 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
41003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41004 LDKRouteHop this_ptr_conv;
41005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41006 this_ptr_conv.is_owned = false;
41007 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41008 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
41012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41013 LDKRouteHop this_ptr_conv;
41014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41015 this_ptr_conv.is_owned = false;
41016 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41017 RouteHop_set_fee_msat(&this_ptr_conv, val);
41020 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41021 LDKRouteHop this_ptr_conv;
41022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41023 this_ptr_conv.is_owned = false;
41024 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41025 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
41029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
41030 LDKRouteHop this_ptr_conv;
41031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41032 this_ptr_conv.is_owned = false;
41033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41034 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
41037 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) {
41038 LDKPublicKey pubkey_arg_ref;
41039 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
41040 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
41041 LDKNodeFeatures node_features_arg_conv;
41042 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
41043 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
41044 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
41045 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
41046 LDKChannelFeatures channel_features_arg_conv;
41047 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
41048 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
41049 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
41050 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
41051 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);
41052 int64_t ret_ref = 0;
41053 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41054 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41055 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41056 ret_ref = (uintptr_t)ret_var.inner;
41057 if (ret_var.is_owned) {
41063 static inline uintptr_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
41064 LDKRouteHop ret_var = RouteHop_clone(arg);
41065 int64_t ret_ref = 0;
41066 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41067 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41068 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41069 ret_ref = (uintptr_t)ret_var.inner;
41070 if (ret_var.is_owned) {
41075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41076 LDKRouteHop arg_conv;
41077 arg_conv.inner = (void*)(arg & (~1));
41078 arg_conv.is_owned = false;
41079 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41080 int64_t ret_val = RouteHop_clone_ptr(&arg_conv);
41084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41085 LDKRouteHop orig_conv;
41086 orig_conv.inner = (void*)(orig & (~1));
41087 orig_conv.is_owned = false;
41088 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41089 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
41090 int64_t ret_ref = 0;
41091 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41092 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41093 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41094 ret_ref = (uintptr_t)ret_var.inner;
41095 if (ret_var.is_owned) {
41101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
41102 LDKRouteHop o_conv;
41103 o_conv.inner = (void*)(o & (~1));
41104 o_conv.is_owned = false;
41105 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41106 int64_t ret_val = RouteHop_hash(&o_conv);
41110 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41111 LDKRouteHop a_conv;
41112 a_conv.inner = (void*)(a & (~1));
41113 a_conv.is_owned = false;
41114 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41115 LDKRouteHop b_conv;
41116 b_conv.inner = (void*)(b & (~1));
41117 b_conv.is_owned = false;
41118 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41119 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
41123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
41124 LDKRouteHop obj_conv;
41125 obj_conv.inner = (void*)(obj & (~1));
41126 obj_conv.is_owned = false;
41127 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41128 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
41129 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41130 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41131 CVec_u8Z_free(ret_var);
41135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41136 LDKu8slice ser_ref;
41137 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41138 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41139 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
41140 *ret_conv = RouteHop_read(ser_ref);
41141 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41142 return (int64_t)ret_conv;
41145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41146 LDKRoute this_obj_conv;
41147 this_obj_conv.inner = (void*)(this_obj & (~1));
41148 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41150 Route_free(this_obj_conv);
41153 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
41154 LDKRoute this_ptr_conv;
41155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41156 this_ptr_conv.is_owned = false;
41157 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41158 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
41159 jobjectArray ret_arr = NULL;
41160 ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
41162 for (size_t m = 0; m < ret_var.datalen; m++) {
41163 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
41164 int64_tArray ret_conv_12_arr = NULL;
41165 ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
41166 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
41167 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
41168 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
41169 int64_t ret_conv_12_conv_10_ref = 0;
41170 CHECK((((uintptr_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41171 CHECK((((uintptr_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41172 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
41173 ret_conv_12_conv_10_ref = (uintptr_t)ret_conv_12_conv_10_var.inner;
41174 if (ret_conv_12_conv_10_var.is_owned) {
41175 ret_conv_12_conv_10_ref |= 1;
41177 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
41179 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
41180 FREE(ret_conv_12_var.data);
41181 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
41184 FREE(ret_var.data);
41188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
41189 LDKRoute this_ptr_conv;
41190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41191 this_ptr_conv.is_owned = false;
41192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41193 LDKCVec_CVec_RouteHopZZ val_constr;
41194 val_constr.datalen = (*env)->GetArrayLength(env, val);
41195 if (val_constr.datalen > 0)
41196 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41198 val_constr.data = NULL;
41199 for (size_t m = 0; m < val_constr.datalen; m++) {
41200 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
41201 LDKCVec_RouteHopZ val_conv_12_constr;
41202 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
41203 if (val_conv_12_constr.datalen > 0)
41204 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41206 val_conv_12_constr.data = NULL;
41207 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
41208 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
41209 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
41210 LDKRouteHop val_conv_12_conv_10_conv;
41211 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
41212 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
41213 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
41214 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
41215 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
41217 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
41218 val_constr.data[m] = val_conv_12_constr;
41220 Route_set_paths(&this_ptr_conv, val_constr);
41223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
41224 LDKRoute this_ptr_conv;
41225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41226 this_ptr_conv.is_owned = false;
41227 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41228 LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
41229 int64_t ret_ref = 0;
41230 if ((uintptr_t)ret_var.inner > 4096) {
41231 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41232 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41233 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41234 ret_ref = (uintptr_t)ret_var.inner;
41235 if (ret_var.is_owned) {
41242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41243 LDKRoute this_ptr_conv;
41244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41245 this_ptr_conv.is_owned = false;
41246 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41247 LDKPaymentParameters val_conv;
41248 val_conv.inner = (void*)(val & (~1));
41249 val_conv.is_owned = (val & 1) || (val == 0);
41250 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41251 val_conv = PaymentParameters_clone(&val_conv);
41252 Route_set_payment_params(&this_ptr_conv, val_conv);
41255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg, int64_t payment_params_arg) {
41256 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
41257 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
41258 if (paths_arg_constr.datalen > 0)
41259 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41261 paths_arg_constr.data = NULL;
41262 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
41263 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
41264 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
41265 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
41266 if (paths_arg_conv_12_constr.datalen > 0)
41267 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41269 paths_arg_conv_12_constr.data = NULL;
41270 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
41271 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
41272 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
41273 LDKRouteHop paths_arg_conv_12_conv_10_conv;
41274 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
41275 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
41276 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
41277 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
41278 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
41280 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
41281 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
41283 LDKPaymentParameters payment_params_arg_conv;
41284 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
41285 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
41286 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41287 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41288 LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
41289 int64_t ret_ref = 0;
41290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41293 ret_ref = (uintptr_t)ret_var.inner;
41294 if (ret_var.is_owned) {
41300 static inline uintptr_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
41301 LDKRoute ret_var = Route_clone(arg);
41302 int64_t ret_ref = 0;
41303 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41304 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41305 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41306 ret_ref = (uintptr_t)ret_var.inner;
41307 if (ret_var.is_owned) {
41312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41314 arg_conv.inner = (void*)(arg & (~1));
41315 arg_conv.is_owned = false;
41316 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41317 int64_t ret_val = Route_clone_ptr(&arg_conv);
41321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41322 LDKRoute orig_conv;
41323 orig_conv.inner = (void*)(orig & (~1));
41324 orig_conv.is_owned = false;
41325 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41326 LDKRoute ret_var = Route_clone(&orig_conv);
41327 int64_t ret_ref = 0;
41328 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41329 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41330 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41331 ret_ref = (uintptr_t)ret_var.inner;
41332 if (ret_var.is_owned) {
41338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
41340 o_conv.inner = (void*)(o & (~1));
41341 o_conv.is_owned = false;
41342 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41343 int64_t ret_val = Route_hash(&o_conv);
41347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41349 a_conv.inner = (void*)(a & (~1));
41350 a_conv.is_owned = false;
41351 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41353 b_conv.inner = (void*)(b & (~1));
41354 b_conv.is_owned = false;
41355 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41356 jboolean ret_val = Route_eq(&a_conv, &b_conv);
41360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
41361 LDKRoute this_arg_conv;
41362 this_arg_conv.inner = (void*)(this_arg & (~1));
41363 this_arg_conv.is_owned = false;
41364 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41365 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
41369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
41370 LDKRoute this_arg_conv;
41371 this_arg_conv.inner = (void*)(this_arg & (~1));
41372 this_arg_conv.is_owned = false;
41373 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41374 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
41378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
41380 obj_conv.inner = (void*)(obj & (~1));
41381 obj_conv.is_owned = false;
41382 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41383 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
41384 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41385 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41386 CVec_u8Z_free(ret_var);
41390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41391 LDKu8slice ser_ref;
41392 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41393 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41394 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
41395 *ret_conv = Route_read(ser_ref);
41396 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41397 return (int64_t)ret_conv;
41400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41401 LDKRouteParameters this_obj_conv;
41402 this_obj_conv.inner = (void*)(this_obj & (~1));
41403 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41404 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41405 RouteParameters_free(this_obj_conv);
41408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
41409 LDKRouteParameters this_ptr_conv;
41410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41411 this_ptr_conv.is_owned = false;
41412 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41413 LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
41414 int64_t ret_ref = 0;
41415 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41416 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41417 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41418 ret_ref = (uintptr_t)ret_var.inner;
41419 if (ret_var.is_owned) {
41425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41426 LDKRouteParameters this_ptr_conv;
41427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41428 this_ptr_conv.is_owned = false;
41429 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41430 LDKPaymentParameters val_conv;
41431 val_conv.inner = (void*)(val & (~1));
41432 val_conv.is_owned = (val & 1) || (val == 0);
41433 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41434 val_conv = PaymentParameters_clone(&val_conv);
41435 RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
41438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
41439 LDKRouteParameters this_ptr_conv;
41440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41441 this_ptr_conv.is_owned = false;
41442 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41443 int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
41447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41448 LDKRouteParameters this_ptr_conv;
41449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41450 this_ptr_conv.is_owned = false;
41451 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41452 RouteParameters_set_final_value_msat(&this_ptr_conv, val);
41455 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41456 LDKRouteParameters this_ptr_conv;
41457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41458 this_ptr_conv.is_owned = false;
41459 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41460 int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
41464 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) {
41465 LDKRouteParameters this_ptr_conv;
41466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41467 this_ptr_conv.is_owned = false;
41468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41469 RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
41472 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) {
41473 LDKPaymentParameters payment_params_arg_conv;
41474 payment_params_arg_conv.inner = (void*)(payment_params_arg & (~1));
41475 payment_params_arg_conv.is_owned = (payment_params_arg & 1) || (payment_params_arg == 0);
41476 CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41477 payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41478 LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
41479 int64_t ret_ref = 0;
41480 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41481 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41482 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41483 ret_ref = (uintptr_t)ret_var.inner;
41484 if (ret_var.is_owned) {
41490 static inline uintptr_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
41491 LDKRouteParameters ret_var = RouteParameters_clone(arg);
41492 int64_t ret_ref = 0;
41493 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41494 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41495 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41496 ret_ref = (uintptr_t)ret_var.inner;
41497 if (ret_var.is_owned) {
41502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41503 LDKRouteParameters arg_conv;
41504 arg_conv.inner = (void*)(arg & (~1));
41505 arg_conv.is_owned = false;
41506 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41507 int64_t ret_val = RouteParameters_clone_ptr(&arg_conv);
41511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41512 LDKRouteParameters orig_conv;
41513 orig_conv.inner = (void*)(orig & (~1));
41514 orig_conv.is_owned = false;
41515 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41516 LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
41517 int64_t ret_ref = 0;
41518 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41519 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41520 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41521 ret_ref = (uintptr_t)ret_var.inner;
41522 if (ret_var.is_owned) {
41528 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
41529 LDKRouteParameters obj_conv;
41530 obj_conv.inner = (void*)(obj & (~1));
41531 obj_conv.is_owned = false;
41532 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41533 LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
41534 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41535 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41536 CVec_u8Z_free(ret_var);
41540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41541 LDKu8slice ser_ref;
41542 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41543 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41544 LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
41545 *ret_conv = RouteParameters_read(ser_ref);
41546 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41547 return (int64_t)ret_conv;
41550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41551 LDKPaymentParameters this_obj_conv;
41552 this_obj_conv.inner = (void*)(this_obj & (~1));
41553 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41554 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41555 PaymentParameters_free(this_obj_conv);
41558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
41559 LDKPaymentParameters this_ptr_conv;
41560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41561 this_ptr_conv.is_owned = false;
41562 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41563 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
41564 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form);
41568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
41569 LDKPaymentParameters this_ptr_conv;
41570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41571 this_ptr_conv.is_owned = false;
41572 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41573 LDKPublicKey val_ref;
41574 CHECK((*env)->GetArrayLength(env, val) == 33);
41575 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
41576 PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
41579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
41580 LDKPaymentParameters this_ptr_conv;
41581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41582 this_ptr_conv.is_owned = false;
41583 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41584 LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
41585 int64_t ret_ref = 0;
41586 if ((uintptr_t)ret_var.inner > 4096) {
41587 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41588 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41589 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41590 ret_ref = (uintptr_t)ret_var.inner;
41591 if (ret_var.is_owned) {
41598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41599 LDKPaymentParameters 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 LDKInvoiceFeatures val_conv;
41604 val_conv.inner = (void*)(val & (~1));
41605 val_conv.is_owned = (val & 1) || (val == 0);
41606 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41607 val_conv = InvoiceFeatures_clone(&val_conv);
41608 PaymentParameters_set_features(&this_ptr_conv, val_conv);
41611 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr) {
41612 LDKPaymentParameters this_ptr_conv;
41613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41614 this_ptr_conv.is_owned = false;
41615 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41616 LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
41617 int64_tArray ret_arr = NULL;
41618 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41619 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41620 for (size_t l = 0; l < ret_var.datalen; l++) {
41621 LDKRouteHint ret_conv_11_var = ret_var.data[l];
41622 int64_t ret_conv_11_ref = 0;
41623 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41624 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41625 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
41626 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
41627 if (ret_conv_11_var.is_owned) {
41628 ret_conv_11_ref |= 1;
41630 ret_arr_ptr[l] = ret_conv_11_ref;
41632 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41633 FREE(ret_var.data);
41637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1route_1hints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
41638 LDKPaymentParameters this_ptr_conv;
41639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41640 this_ptr_conv.is_owned = false;
41641 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41642 LDKCVec_RouteHintZ val_constr;
41643 val_constr.datalen = (*env)->GetArrayLength(env, val);
41644 if (val_constr.datalen > 0)
41645 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
41647 val_constr.data = NULL;
41648 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
41649 for (size_t l = 0; l < val_constr.datalen; l++) {
41650 int64_t val_conv_11 = val_vals[l];
41651 LDKRouteHint val_conv_11_conv;
41652 val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
41653 val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
41654 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
41655 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
41656 val_constr.data[l] = val_conv_11_conv;
41658 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
41659 PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
41662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
41663 LDKPaymentParameters this_ptr_conv;
41664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41665 this_ptr_conv.is_owned = false;
41666 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41667 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41668 *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
41669 int64_t ret_ref = (uintptr_t)ret_copy;
41673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41674 LDKPaymentParameters this_ptr_conv;
41675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41676 this_ptr_conv.is_owned = false;
41677 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41678 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
41679 CHECK_ACCESS(val_ptr);
41680 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41681 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
41682 PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
41685 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
41686 LDKPaymentParameters this_ptr_conv;
41687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41688 this_ptr_conv.is_owned = false;
41689 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41690 int32_t ret_val = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
41694 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) {
41695 LDKPaymentParameters this_ptr_conv;
41696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41697 this_ptr_conv.is_owned = false;
41698 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41699 PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
41702 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) {
41703 LDKPublicKey payee_pubkey_arg_ref;
41704 CHECK((*env)->GetArrayLength(env, payee_pubkey_arg) == 33);
41705 (*env)->GetByteArrayRegion(env, payee_pubkey_arg, 0, 33, payee_pubkey_arg_ref.compressed_form);
41706 LDKInvoiceFeatures features_arg_conv;
41707 features_arg_conv.inner = (void*)(features_arg & (~1));
41708 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
41709 CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
41710 features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
41711 LDKCVec_RouteHintZ route_hints_arg_constr;
41712 route_hints_arg_constr.datalen = (*env)->GetArrayLength(env, route_hints_arg);
41713 if (route_hints_arg_constr.datalen > 0)
41714 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
41716 route_hints_arg_constr.data = NULL;
41717 int64_t* route_hints_arg_vals = (*env)->GetLongArrayElements (env, route_hints_arg, NULL);
41718 for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
41719 int64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
41720 LDKRouteHint route_hints_arg_conv_11_conv;
41721 route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
41722 route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
41723 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
41724 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
41725 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
41727 (*env)->ReleaseLongArrayElements(env, route_hints_arg, route_hints_arg_vals, 0);
41728 void* expiry_time_arg_ptr = (void*)(((uintptr_t)expiry_time_arg) & ~1);
41729 CHECK_ACCESS(expiry_time_arg_ptr);
41730 LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
41731 expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)expiry_time_arg) & ~1));
41732 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);
41733 int64_t ret_ref = 0;
41734 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41735 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41736 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41737 ret_ref = (uintptr_t)ret_var.inner;
41738 if (ret_var.is_owned) {
41744 static inline uintptr_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
41745 LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
41746 int64_t ret_ref = 0;
41747 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41748 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41749 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41750 ret_ref = (uintptr_t)ret_var.inner;
41751 if (ret_var.is_owned) {
41756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41757 LDKPaymentParameters arg_conv;
41758 arg_conv.inner = (void*)(arg & (~1));
41759 arg_conv.is_owned = false;
41760 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41761 int64_t ret_val = PaymentParameters_clone_ptr(&arg_conv);
41765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41766 LDKPaymentParameters orig_conv;
41767 orig_conv.inner = (void*)(orig & (~1));
41768 orig_conv.is_owned = false;
41769 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41770 LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
41771 int64_t ret_ref = 0;
41772 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41773 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41774 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41775 ret_ref = (uintptr_t)ret_var.inner;
41776 if (ret_var.is_owned) {
41782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
41783 LDKPaymentParameters o_conv;
41784 o_conv.inner = (void*)(o & (~1));
41785 o_conv.is_owned = false;
41786 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41787 int64_t ret_val = PaymentParameters_hash(&o_conv);
41791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41792 LDKPaymentParameters a_conv;
41793 a_conv.inner = (void*)(a & (~1));
41794 a_conv.is_owned = false;
41795 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41796 LDKPaymentParameters b_conv;
41797 b_conv.inner = (void*)(b & (~1));
41798 b_conv.is_owned = false;
41799 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41800 jboolean ret_val = PaymentParameters_eq(&a_conv, &b_conv);
41804 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
41805 LDKPaymentParameters obj_conv;
41806 obj_conv.inner = (void*)(obj & (~1));
41807 obj_conv.is_owned = false;
41808 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41809 LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
41810 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41811 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41812 CVec_u8Z_free(ret_var);
41816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41817 LDKu8slice ser_ref;
41818 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41819 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41820 LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
41821 *ret_conv = PaymentParameters_read(ser_ref);
41822 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41823 return (int64_t)ret_conv;
41826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1node_1id(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
41827 LDKPublicKey payee_pubkey_ref;
41828 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
41829 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
41830 LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
41831 int64_t ret_ref = 0;
41832 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41833 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41834 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41835 ret_ref = (uintptr_t)ret_var.inner;
41836 if (ret_var.is_owned) {
41842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1for_1keysend(JNIEnv *env, jclass clz, int8_tArray payee_pubkey) {
41843 LDKPublicKey payee_pubkey_ref;
41844 CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
41845 (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
41846 LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
41847 int64_t ret_ref = 0;
41848 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41849 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41850 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41851 ret_ref = (uintptr_t)ret_var.inner;
41852 if (ret_var.is_owned) {
41858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41859 LDKRouteHint this_obj_conv;
41860 this_obj_conv.inner = (void*)(this_obj & (~1));
41861 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
41862 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41863 RouteHint_free(this_obj_conv);
41866 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
41867 LDKRouteHint this_ptr_conv;
41868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41869 this_ptr_conv.is_owned = false;
41870 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41871 LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
41872 int64_tArray ret_arr = NULL;
41873 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41874 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41875 for (size_t o = 0; o < ret_var.datalen; o++) {
41876 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
41877 int64_t ret_conv_14_ref = 0;
41878 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41879 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41880 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
41881 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
41882 if (ret_conv_14_var.is_owned) {
41883 ret_conv_14_ref |= 1;
41885 ret_arr_ptr[o] = ret_conv_14_ref;
41887 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41888 FREE(ret_var.data);
41892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
41893 LDKRouteHint this_ptr_conv;
41894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
41895 this_ptr_conv.is_owned = false;
41896 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41897 LDKCVec_RouteHintHopZ val_constr;
41898 val_constr.datalen = (*env)->GetArrayLength(env, val);
41899 if (val_constr.datalen > 0)
41900 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
41902 val_constr.data = NULL;
41903 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
41904 for (size_t o = 0; o < val_constr.datalen; o++) {
41905 int64_t val_conv_14 = val_vals[o];
41906 LDKRouteHintHop val_conv_14_conv;
41907 val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
41908 val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
41909 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
41910 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
41911 val_constr.data[o] = val_conv_14_conv;
41913 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
41914 RouteHint_set_a(&this_ptr_conv, val_constr);
41917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
41918 LDKCVec_RouteHintHopZ a_arg_constr;
41919 a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
41920 if (a_arg_constr.datalen > 0)
41921 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
41923 a_arg_constr.data = NULL;
41924 int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
41925 for (size_t o = 0; o < a_arg_constr.datalen; o++) {
41926 int64_t a_arg_conv_14 = a_arg_vals[o];
41927 LDKRouteHintHop a_arg_conv_14_conv;
41928 a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
41929 a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
41930 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
41931 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
41932 a_arg_constr.data[o] = a_arg_conv_14_conv;
41934 (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
41935 LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
41936 int64_t ret_ref = 0;
41937 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41938 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41939 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41940 ret_ref = (uintptr_t)ret_var.inner;
41941 if (ret_var.is_owned) {
41947 static inline uintptr_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
41948 LDKRouteHint ret_var = RouteHint_clone(arg);
41949 int64_t ret_ref = 0;
41950 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41951 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41952 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41953 ret_ref = (uintptr_t)ret_var.inner;
41954 if (ret_var.is_owned) {
41959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41960 LDKRouteHint arg_conv;
41961 arg_conv.inner = (void*)(arg & (~1));
41962 arg_conv.is_owned = false;
41963 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41964 int64_t ret_val = RouteHint_clone_ptr(&arg_conv);
41968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41969 LDKRouteHint orig_conv;
41970 orig_conv.inner = (void*)(orig & (~1));
41971 orig_conv.is_owned = false;
41972 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41973 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
41974 int64_t ret_ref = 0;
41975 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
41976 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
41977 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41978 ret_ref = (uintptr_t)ret_var.inner;
41979 if (ret_var.is_owned) {
41985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
41986 LDKRouteHint o_conv;
41987 o_conv.inner = (void*)(o & (~1));
41988 o_conv.is_owned = false;
41989 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41990 int64_t ret_val = RouteHint_hash(&o_conv);
41994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41995 LDKRouteHint a_conv;
41996 a_conv.inner = (void*)(a & (~1));
41997 a_conv.is_owned = false;
41998 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41999 LDKRouteHint b_conv;
42000 b_conv.inner = (void*)(b & (~1));
42001 b_conv.is_owned = false;
42002 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42003 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
42007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
42008 LDKRouteHint obj_conv;
42009 obj_conv.inner = (void*)(obj & (~1));
42010 obj_conv.is_owned = false;
42011 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42012 LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
42013 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42014 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42015 CVec_u8Z_free(ret_var);
42019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42020 LDKu8slice ser_ref;
42021 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42022 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42023 LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
42024 *ret_conv = RouteHint_read(ser_ref);
42025 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42026 return (int64_t)ret_conv;
42029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42030 LDKRouteHintHop this_obj_conv;
42031 this_obj_conv.inner = (void*)(this_obj & (~1));
42032 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42033 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42034 RouteHintHop_free(this_obj_conv);
42037 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42038 LDKRouteHintHop this_ptr_conv;
42039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42040 this_ptr_conv.is_owned = false;
42041 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42042 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42043 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
42047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42048 LDKRouteHintHop this_ptr_conv;
42049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42050 this_ptr_conv.is_owned = false;
42051 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42052 LDKPublicKey val_ref;
42053 CHECK((*env)->GetArrayLength(env, val) == 33);
42054 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42055 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
42058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42059 LDKRouteHintHop this_ptr_conv;
42060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42061 this_ptr_conv.is_owned = false;
42062 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42063 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
42067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42068 LDKRouteHintHop this_ptr_conv;
42069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42070 this_ptr_conv.is_owned = false;
42071 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42072 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
42075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
42076 LDKRouteHintHop this_ptr_conv;
42077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42078 this_ptr_conv.is_owned = false;
42079 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42080 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
42081 int64_t ret_ref = 0;
42082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42085 ret_ref = (uintptr_t)ret_var.inner;
42086 if (ret_var.is_owned) {
42092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42093 LDKRouteHintHop this_ptr_conv;
42094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42095 this_ptr_conv.is_owned = false;
42096 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42097 LDKRoutingFees val_conv;
42098 val_conv.inner = (void*)(val & (~1));
42099 val_conv.is_owned = (val & 1) || (val == 0);
42100 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42101 val_conv = RoutingFees_clone(&val_conv);
42102 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
42105 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
42106 LDKRouteHintHop this_ptr_conv;
42107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42108 this_ptr_conv.is_owned = false;
42109 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42110 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
42114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
42115 LDKRouteHintHop this_ptr_conv;
42116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42117 this_ptr_conv.is_owned = false;
42118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42119 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
42122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42123 LDKRouteHintHop this_ptr_conv;
42124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42125 this_ptr_conv.is_owned = false;
42126 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42127 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42128 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
42129 int64_t ret_ref = (uintptr_t)ret_copy;
42133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42134 LDKRouteHintHop this_ptr_conv;
42135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42136 this_ptr_conv.is_owned = false;
42137 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42138 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42139 CHECK_ACCESS(val_ptr);
42140 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42141 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42142 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
42145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42146 LDKRouteHintHop this_ptr_conv;
42147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42148 this_ptr_conv.is_owned = false;
42149 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42150 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42151 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
42152 int64_t ret_ref = (uintptr_t)ret_copy;
42156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42157 LDKRouteHintHop this_ptr_conv;
42158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42159 this_ptr_conv.is_owned = false;
42160 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42161 void* val_ptr = (void*)(((uintptr_t)val) & ~1);
42162 CHECK_ACCESS(val_ptr);
42163 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42164 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1));
42165 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
42168 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) {
42169 LDKPublicKey src_node_id_arg_ref;
42170 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
42171 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
42172 LDKRoutingFees fees_arg_conv;
42173 fees_arg_conv.inner = (void*)(fees_arg & (~1));
42174 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
42175 CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
42176 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
42177 void* htlc_minimum_msat_arg_ptr = (void*)(((uintptr_t)htlc_minimum_msat_arg) & ~1);
42178 CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
42179 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
42180 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_minimum_msat_arg) & ~1));
42181 void* htlc_maximum_msat_arg_ptr = (void*)(((uintptr_t)htlc_maximum_msat_arg) & ~1);
42182 CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
42183 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
42184 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)htlc_maximum_msat_arg) & ~1));
42185 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);
42186 int64_t ret_ref = 0;
42187 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42188 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42189 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42190 ret_ref = (uintptr_t)ret_var.inner;
42191 if (ret_var.is_owned) {
42197 static inline uintptr_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
42198 LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
42199 int64_t ret_ref = 0;
42200 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42201 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42202 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42203 ret_ref = (uintptr_t)ret_var.inner;
42204 if (ret_var.is_owned) {
42209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42210 LDKRouteHintHop arg_conv;
42211 arg_conv.inner = (void*)(arg & (~1));
42212 arg_conv.is_owned = false;
42213 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42214 int64_t ret_val = RouteHintHop_clone_ptr(&arg_conv);
42218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42219 LDKRouteHintHop orig_conv;
42220 orig_conv.inner = (void*)(orig & (~1));
42221 orig_conv.is_owned = false;
42222 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42223 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
42224 int64_t ret_ref = 0;
42225 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42226 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42227 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42228 ret_ref = (uintptr_t)ret_var.inner;
42229 if (ret_var.is_owned) {
42235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
42236 LDKRouteHintHop o_conv;
42237 o_conv.inner = (void*)(o & (~1));
42238 o_conv.is_owned = false;
42239 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42240 int64_t ret_val = RouteHintHop_hash(&o_conv);
42244 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42245 LDKRouteHintHop a_conv;
42246 a_conv.inner = (void*)(a & (~1));
42247 a_conv.is_owned = false;
42248 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42249 LDKRouteHintHop b_conv;
42250 b_conv.inner = (void*)(b & (~1));
42251 b_conv.is_owned = false;
42252 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42253 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
42257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
42258 LDKRouteHintHop obj_conv;
42259 obj_conv.inner = (void*)(obj & (~1));
42260 obj_conv.is_owned = false;
42261 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42262 LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
42263 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42264 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42265 CVec_u8Z_free(ret_var);
42269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42270 LDKu8slice ser_ref;
42271 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42272 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42273 LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
42274 *ret_conv = RouteHintHop_read(ser_ref);
42275 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42276 return (int64_t)ret_conv;
42279 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) {
42280 LDKPublicKey our_node_pubkey_ref;
42281 CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
42282 (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
42283 LDKRouteParameters route_params_conv;
42284 route_params_conv.inner = (void*)(route_params & (~1));
42285 route_params_conv.is_owned = false;
42286 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42287 LDKNetworkGraph network_conv;
42288 network_conv.inner = (void*)(network & (~1));
42289 network_conv.is_owned = false;
42290 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_conv);
42291 LDKCVec_ChannelDetailsZ first_hops_constr;
42292 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
42293 if (first_hops != NULL) {
42294 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
42295 if (first_hops_constr.datalen > 0)
42296 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
42298 first_hops_constr.data = NULL;
42299 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
42300 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
42301 int64_t first_hops_conv_16 = first_hops_vals[q];
42302 LDKChannelDetails first_hops_conv_16_conv;
42303 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
42304 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
42305 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
42306 first_hops_constr.data[q] = first_hops_conv_16_conv;
42308 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
42309 first_hops_ptr = &first_hops_constr;
42311 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
42312 CHECK_ACCESS(logger_ptr);
42313 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42314 if (logger_conv.free == LDKLogger_JCalls_free) {
42315 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42316 LDKLogger_JCalls_cloned(&logger_conv);
42318 void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1);
42319 if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
42320 LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
42321 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
42322 *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
42323 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
42324 return (int64_t)ret_conv;
42327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42328 if ((this_ptr & 1) != 0) return;
42329 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42330 CHECK_ACCESS(this_ptr_ptr);
42331 LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
42332 FREE((void*)this_ptr);
42333 Score_free(this_ptr_conv);
42336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42337 if ((this_ptr & 1) != 0) return;
42338 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42339 CHECK_ACCESS(this_ptr_ptr);
42340 LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
42341 FREE((void*)this_ptr);
42342 LockableScore_free(this_ptr_conv);
42345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42346 LDKMultiThreadedLockableScore this_obj_conv;
42347 this_obj_conv.inner = (void*)(this_obj & (~1));
42348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42349 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42350 MultiThreadedLockableScore_free(this_obj_conv);
42353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
42354 void* score_ptr = (void*)(((uintptr_t)score) & ~1);
42355 CHECK_ACCESS(score_ptr);
42356 LDKScore score_conv = *(LDKScore*)(score_ptr);
42357 if (score_conv.free == LDKScore_JCalls_free) {
42358 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42359 LDKScore_JCalls_cloned(&score_conv);
42361 LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
42362 int64_t ret_ref = 0;
42363 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42364 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42365 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42366 ret_ref = (uintptr_t)ret_var.inner;
42367 if (ret_var.is_owned) {
42373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42374 LDKFixedPenaltyScorer this_obj_conv;
42375 this_obj_conv.inner = (void*)(this_obj & (~1));
42376 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42377 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42378 FixedPenaltyScorer_free(this_obj_conv);
42381 static inline uintptr_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
42382 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
42383 int64_t ret_ref = 0;
42384 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42385 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42386 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42387 ret_ref = (uintptr_t)ret_var.inner;
42388 if (ret_var.is_owned) {
42393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42394 LDKFixedPenaltyScorer arg_conv;
42395 arg_conv.inner = (void*)(arg & (~1));
42396 arg_conv.is_owned = false;
42397 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42398 int64_t ret_val = FixedPenaltyScorer_clone_ptr(&arg_conv);
42402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42403 LDKFixedPenaltyScorer orig_conv;
42404 orig_conv.inner = (void*)(orig & (~1));
42405 orig_conv.is_owned = false;
42406 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42407 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
42408 int64_t ret_ref = 0;
42409 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42410 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42411 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42412 ret_ref = (uintptr_t)ret_var.inner;
42413 if (ret_var.is_owned) {
42419 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
42420 LDKFixedPenaltyScorer obj_conv;
42421 obj_conv.inner = (void*)(obj & (~1));
42422 obj_conv.is_owned = false;
42423 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42424 LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
42425 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42426 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42427 CVec_u8Z_free(ret_var);
42431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42432 LDKu8slice ser_ref;
42433 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42434 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42435 LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
42436 *ret_conv = FixedPenaltyScorer_read(ser_ref);
42437 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42438 return (int64_t)ret_conv;
42441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
42442 LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
42443 int64_t ret_ref = 0;
42444 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42445 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42446 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42447 ret_ref = (uintptr_t)ret_var.inner;
42448 if (ret_var.is_owned) {
42454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
42455 LDKFixedPenaltyScorer this_arg_conv;
42456 this_arg_conv.inner = (void*)(this_arg & (~1));
42457 this_arg_conv.is_owned = false;
42458 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42459 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42460 *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
42461 return (int64_t)ret_ret;
42464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42465 LDKScorer this_obj_conv;
42466 this_obj_conv.inner = (void*)(this_obj & (~1));
42467 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42468 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42469 Scorer_free(this_obj_conv);
42472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42473 LDKScoringParameters this_obj_conv;
42474 this_obj_conv.inner = (void*)(this_obj & (~1));
42475 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42476 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42477 ScoringParameters_free(this_obj_conv);
42480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42481 LDKScoringParameters this_ptr_conv;
42482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42483 this_ptr_conv.is_owned = false;
42484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42485 int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
42489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42490 LDKScoringParameters this_ptr_conv;
42491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42492 this_ptr_conv.is_owned = false;
42493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42494 ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
42497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42498 LDKScoringParameters this_ptr_conv;
42499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42500 this_ptr_conv.is_owned = false;
42501 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42502 int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
42506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42507 LDKScoringParameters this_ptr_conv;
42508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42509 this_ptr_conv.is_owned = false;
42510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42511 ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
42514 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
42515 LDKScoringParameters this_ptr_conv;
42516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42517 this_ptr_conv.is_owned = false;
42518 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42519 int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv);
42523 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) {
42524 LDKScoringParameters this_ptr_conv;
42525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42526 this_ptr_conv.is_owned = false;
42527 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42528 ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val);
42531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) {
42532 LDKScoringParameters this_ptr_conv;
42533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42534 this_ptr_conv.is_owned = false;
42535 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42536 int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv);
42540 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) {
42541 LDKScoringParameters this_ptr_conv;
42542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42543 this_ptr_conv.is_owned = false;
42544 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42545 ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val);
42548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
42549 LDKScoringParameters this_ptr_conv;
42550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42551 this_ptr_conv.is_owned = false;
42552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42553 int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
42557 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) {
42558 LDKScoringParameters this_ptr_conv;
42559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42560 this_ptr_conv.is_owned = false;
42561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42562 ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
42565 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) {
42566 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);
42567 int64_t ret_ref = 0;
42568 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42569 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42570 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42571 ret_ref = (uintptr_t)ret_var.inner;
42572 if (ret_var.is_owned) {
42578 static inline uintptr_t ScoringParameters_clone_ptr(LDKScoringParameters *NONNULL_PTR arg) {
42579 LDKScoringParameters ret_var = ScoringParameters_clone(arg);
42580 int64_t ret_ref = 0;
42581 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42582 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42583 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42584 ret_ref = (uintptr_t)ret_var.inner;
42585 if (ret_var.is_owned) {
42590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42591 LDKScoringParameters arg_conv;
42592 arg_conv.inner = (void*)(arg & (~1));
42593 arg_conv.is_owned = false;
42594 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42595 int64_t ret_val = ScoringParameters_clone_ptr(&arg_conv);
42599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42600 LDKScoringParameters orig_conv;
42601 orig_conv.inner = (void*)(orig & (~1));
42602 orig_conv.is_owned = false;
42603 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42604 LDKScoringParameters ret_var = ScoringParameters_clone(&orig_conv);
42605 int64_t ret_ref = 0;
42606 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42607 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42608 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42609 ret_ref = (uintptr_t)ret_var.inner;
42610 if (ret_var.is_owned) {
42616 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
42617 LDKScoringParameters obj_conv;
42618 obj_conv.inner = (void*)(obj & (~1));
42619 obj_conv.is_owned = false;
42620 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42621 LDKCVec_u8Z ret_var = ScoringParameters_write(&obj_conv);
42622 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42623 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42624 CVec_u8Z_free(ret_var);
42628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42629 LDKu8slice ser_ref;
42630 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42631 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42632 LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ");
42633 *ret_conv = ScoringParameters_read(ser_ref);
42634 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42635 return (int64_t)ret_conv;
42638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t params) {
42639 LDKScoringParameters params_conv;
42640 params_conv.inner = (void*)(params & (~1));
42641 params_conv.is_owned = (params & 1) || (params == 0);
42642 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
42643 params_conv = ScoringParameters_clone(¶ms_conv);
42644 LDKScorer ret_var = Scorer_new(params_conv);
42645 int64_t ret_ref = 0;
42646 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42647 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42648 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42649 ret_ref = (uintptr_t)ret_var.inner;
42650 if (ret_var.is_owned) {
42656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) {
42657 LDKScorer ret_var = Scorer_default();
42658 int64_t ret_ref = 0;
42659 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42660 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42661 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42662 ret_ref = (uintptr_t)ret_var.inner;
42663 if (ret_var.is_owned) {
42669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1default(JNIEnv *env, jclass clz) {
42670 LDKScoringParameters ret_var = ScoringParameters_default();
42671 int64_t ret_ref = 0;
42672 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42673 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42674 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42675 ret_ref = (uintptr_t)ret_var.inner;
42676 if (ret_var.is_owned) {
42682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
42683 LDKScorer this_arg_conv;
42684 this_arg_conv.inner = (void*)(this_arg & (~1));
42685 this_arg_conv.is_owned = false;
42686 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42687 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42688 *ret_ret = Scorer_as_Score(&this_arg_conv);
42689 return (int64_t)ret_ret;
42692 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Scorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
42693 LDKScorer obj_conv;
42694 obj_conv.inner = (void*)(obj & (~1));
42695 obj_conv.is_owned = false;
42696 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42697 LDKCVec_u8Z ret_var = Scorer_write(&obj_conv);
42698 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42699 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42700 CVec_u8Z_free(ret_var);
42704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42705 LDKu8slice ser_ref;
42706 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42707 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42708 LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ");
42709 *ret_conv = Scorer_read(ser_ref);
42710 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42711 return (int64_t)ret_conv;
42714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42715 LDKProbabilisticScorer this_obj_conv;
42716 this_obj_conv.inner = (void*)(this_obj & (~1));
42717 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42718 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42719 ProbabilisticScorer_free(this_obj_conv);
42722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42723 LDKProbabilisticScoringParameters this_obj_conv;
42724 this_obj_conv.inner = (void*)(this_obj & (~1));
42725 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42726 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42727 ProbabilisticScoringParameters_free(this_obj_conv);
42730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42731 LDKProbabilisticScoringParameters this_ptr_conv;
42732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42733 this_ptr_conv.is_owned = false;
42734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42735 int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
42739 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) {
42740 LDKProbabilisticScoringParameters this_ptr_conv;
42741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42742 this_ptr_conv.is_owned = false;
42743 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42744 ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
42747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
42748 LDKProbabilisticScoringParameters this_ptr_conv;
42749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42750 this_ptr_conv.is_owned = false;
42751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42752 int64_t ret_val = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
42756 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) {
42757 LDKProbabilisticScoringParameters this_ptr_conv;
42758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
42759 this_ptr_conv.is_owned = false;
42760 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42761 ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
42764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg) {
42765 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg);
42766 int64_t ret_ref = 0;
42767 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42768 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42769 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42770 ret_ref = (uintptr_t)ret_var.inner;
42771 if (ret_var.is_owned) {
42777 static inline uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
42778 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
42779 int64_t ret_ref = 0;
42780 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42781 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42782 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42783 ret_ref = (uintptr_t)ret_var.inner;
42784 if (ret_var.is_owned) {
42789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42790 LDKProbabilisticScoringParameters arg_conv;
42791 arg_conv.inner = (void*)(arg & (~1));
42792 arg_conv.is_owned = false;
42793 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42794 int64_t ret_val = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
42798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42799 LDKProbabilisticScoringParameters orig_conv;
42800 orig_conv.inner = (void*)(orig & (~1));
42801 orig_conv.is_owned = false;
42802 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42803 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
42804 int64_t ret_ref = 0;
42805 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42806 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42807 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42808 ret_ref = (uintptr_t)ret_var.inner;
42809 if (ret_var.is_owned) {
42815 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
42816 LDKProbabilisticScoringParameters obj_conv;
42817 obj_conv.inner = (void*)(obj & (~1));
42818 obj_conv.is_owned = false;
42819 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42820 LDKCVec_u8Z ret_var = ProbabilisticScoringParameters_write(&obj_conv);
42821 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42822 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42823 CVec_u8Z_free(ret_var);
42827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
42828 LDKu8slice ser_ref;
42829 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42830 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42831 LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ");
42832 *ret_conv = ProbabilisticScoringParameters_read(ser_ref);
42833 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42834 return (int64_t)ret_conv;
42837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t params, int64_t network_graph) {
42838 LDKProbabilisticScoringParameters params_conv;
42839 params_conv.inner = (void*)(params & (~1));
42840 params_conv.is_owned = (params & 1) || (params == 0);
42841 CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
42842 params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
42843 LDKNetworkGraph network_graph_conv;
42844 network_graph_conv.inner = (void*)(network_graph & (~1));
42845 network_graph_conv.is_owned = false;
42846 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
42847 LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv);
42848 int64_t ret_ref = 0;
42849 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42850 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42851 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42852 ret_ref = (uintptr_t)ret_var.inner;
42853 if (ret_var.is_owned) {
42859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1default(JNIEnv *env, jclass clz) {
42860 LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
42861 int64_t ret_ref = 0;
42862 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42863 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42864 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42865 ret_ref = (uintptr_t)ret_var.inner;
42866 if (ret_var.is_owned) {
42872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
42873 LDKProbabilisticScorer this_arg_conv;
42874 this_arg_conv.inner = (void*)(this_arg & (~1));
42875 this_arg_conv.is_owned = false;
42876 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42877 LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42878 *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
42879 return (int64_t)ret_ret;
42882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
42883 LDKProbabilisticScorer obj_conv;
42884 obj_conv.inner = (void*)(obj & (~1));
42885 obj_conv.is_owned = false;
42886 CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42887 LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
42888 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
42889 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
42890 CVec_u8Z_free(ret_var);
42894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
42895 LDKu8slice ser_ref;
42896 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42897 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42898 void* arg_ptr = (void*)(((uintptr_t)arg) & ~1);
42899 CHECK_ACCESS(arg_ptr);
42900 LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ arg_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg_ptr);
42901 arg_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone((LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(((uintptr_t)arg) & ~1));
42902 LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
42903 *ret_conv = ProbabilisticScorer_read(ser_ref, arg_conv);
42904 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42905 return (int64_t)ret_conv;
42908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42909 LDKFilesystemPersister this_obj_conv;
42910 this_obj_conv.inner = (void*)(this_obj & (~1));
42911 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42912 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42913 FilesystemPersister_free(this_obj_conv);
42916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
42917 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
42918 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
42919 int64_t ret_ref = 0;
42920 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
42921 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
42922 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42923 ret_ref = (uintptr_t)ret_var.inner;
42924 if (ret_var.is_owned) {
42930 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
42931 LDKFilesystemPersister this_arg_conv;
42932 this_arg_conv.inner = (void*)(this_arg & (~1));
42933 this_arg_conv.is_owned = false;
42934 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42935 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
42936 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
42942 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
42943 LDKChannelManager manager_conv;
42944 manager_conv.inner = (void*)(manager & (~1));
42945 manager_conv.is_owned = false;
42946 CHECK_INNER_FIELD_ACCESS_OR_NULL(manager_conv);
42947 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
42948 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
42949 return (int64_t)ret_conv;
42952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
42953 LDKFilesystemPersister this_arg_conv;
42954 this_arg_conv.inner = (void*)(this_arg & (~1));
42955 this_arg_conv.is_owned = false;
42956 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42957 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
42958 CHECK_ACCESS(keys_manager_ptr);
42959 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
42960 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
42961 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42962 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
42964 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
42965 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
42966 return (int64_t)ret_conv;
42969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
42970 LDKFilesystemPersister this_arg_conv;
42971 this_arg_conv.inner = (void*)(this_arg & (~1));
42972 this_arg_conv.is_owned = false;
42973 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42974 LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
42975 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
42976 return (int64_t)ret_ret;
42979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42980 LDKBackgroundProcessor this_obj_conv;
42981 this_obj_conv.inner = (void*)(this_obj & (~1));
42982 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
42983 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42984 BackgroundProcessor_free(this_obj_conv);
42987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42988 if ((this_ptr & 1) != 0) return;
42989 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
42990 CHECK_ACCESS(this_ptr_ptr);
42991 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr);
42992 FREE((void*)this_ptr);
42993 ChannelManagerPersister_free(this_ptr_conv);
42996 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) {
42997 void* persister_ptr = (void*)(((uintptr_t)persister) & ~1);
42998 CHECK_ACCESS(persister_ptr);
42999 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr);
43000 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
43001 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43002 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
43004 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
43005 CHECK_ACCESS(event_handler_ptr);
43006 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
43007 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
43008 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43009 LDKEventHandler_JCalls_cloned(&event_handler_conv);
43011 LDKChainMonitor chain_monitor_conv;
43012 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
43013 chain_monitor_conv.is_owned = false;
43014 CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
43015 LDKChannelManager channel_manager_conv;
43016 channel_manager_conv.inner = (void*)(channel_manager & (~1));
43017 channel_manager_conv.is_owned = false;
43018 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
43019 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
43020 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
43021 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
43022 CHECK_INNER_FIELD_ACCESS_OR_NULL(net_graph_msg_handler_conv);
43023 LDKPeerManager peer_manager_conv;
43024 peer_manager_conv.inner = (void*)(peer_manager & (~1));
43025 peer_manager_conv.is_owned = false;
43026 CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
43027 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
43028 CHECK_ACCESS(logger_ptr);
43029 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43030 if (logger_conv.free == LDKLogger_JCalls_free) {
43031 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43032 LDKLogger_JCalls_cloned(&logger_conv);
43034 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);
43035 int64_t ret_ref = 0;
43036 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43037 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43038 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43039 ret_ref = (uintptr_t)ret_var.inner;
43040 if (ret_var.is_owned) {
43046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
43047 LDKBackgroundProcessor this_arg_conv;
43048 this_arg_conv.inner = (void*)(this_arg & (~1));
43049 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43051 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
43052 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
43053 *ret_conv = BackgroundProcessor_join(this_arg_conv);
43054 return (int64_t)ret_conv;
43057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
43058 LDKBackgroundProcessor this_arg_conv;
43059 this_arg_conv.inner = (void*)(this_arg & (~1));
43060 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
43061 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43062 // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
43063 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
43064 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
43065 return (int64_t)ret_conv;
43068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43069 LDKInvoice this_obj_conv;
43070 this_obj_conv.inner = (void*)(this_obj & (~1));
43071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43072 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43073 Invoice_free(this_obj_conv);
43076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43078 a_conv.inner = (void*)(a & (~1));
43079 a_conv.is_owned = false;
43080 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43082 b_conv.inner = (void*)(b & (~1));
43083 b_conv.is_owned = false;
43084 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43085 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
43089 static inline uintptr_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
43090 LDKInvoice ret_var = Invoice_clone(arg);
43091 int64_t ret_ref = 0;
43092 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43093 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43094 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43095 ret_ref = (uintptr_t)ret_var.inner;
43096 if (ret_var.is_owned) {
43101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43102 LDKInvoice arg_conv;
43103 arg_conv.inner = (void*)(arg & (~1));
43104 arg_conv.is_owned = false;
43105 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43106 int64_t ret_val = Invoice_clone_ptr(&arg_conv);
43110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43111 LDKInvoice orig_conv;
43112 orig_conv.inner = (void*)(orig & (~1));
43113 orig_conv.is_owned = false;
43114 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43115 LDKInvoice ret_var = Invoice_clone(&orig_conv);
43116 int64_t ret_ref = 0;
43117 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43118 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43119 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43120 ret_ref = (uintptr_t)ret_var.inner;
43121 if (ret_var.is_owned) {
43127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43128 LDKSignedRawInvoice this_obj_conv;
43129 this_obj_conv.inner = (void*)(this_obj & (~1));
43130 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43131 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43132 SignedRawInvoice_free(this_obj_conv);
43135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43136 LDKSignedRawInvoice a_conv;
43137 a_conv.inner = (void*)(a & (~1));
43138 a_conv.is_owned = false;
43139 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43140 LDKSignedRawInvoice b_conv;
43141 b_conv.inner = (void*)(b & (~1));
43142 b_conv.is_owned = false;
43143 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43144 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
43148 static inline uintptr_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
43149 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
43150 int64_t ret_ref = 0;
43151 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43152 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43153 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43154 ret_ref = (uintptr_t)ret_var.inner;
43155 if (ret_var.is_owned) {
43160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43161 LDKSignedRawInvoice arg_conv;
43162 arg_conv.inner = (void*)(arg & (~1));
43163 arg_conv.is_owned = false;
43164 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43165 int64_t ret_val = SignedRawInvoice_clone_ptr(&arg_conv);
43169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43170 LDKSignedRawInvoice orig_conv;
43171 orig_conv.inner = (void*)(orig & (~1));
43172 orig_conv.is_owned = false;
43173 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43174 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
43175 int64_t ret_ref = 0;
43176 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43177 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43178 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43179 ret_ref = (uintptr_t)ret_var.inner;
43180 if (ret_var.is_owned) {
43186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43187 LDKRawInvoice this_obj_conv;
43188 this_obj_conv.inner = (void*)(this_obj & (~1));
43189 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43191 RawInvoice_free(this_obj_conv);
43194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
43195 LDKRawInvoice this_ptr_conv;
43196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43197 this_ptr_conv.is_owned = false;
43198 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43199 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
43200 int64_t ret_ref = 0;
43201 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43202 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43203 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43204 ret_ref = (uintptr_t)ret_var.inner;
43205 if (ret_var.is_owned) {
43211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43212 LDKRawInvoice this_ptr_conv;
43213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43214 this_ptr_conv.is_owned = false;
43215 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43216 LDKRawDataPart val_conv;
43217 val_conv.inner = (void*)(val & (~1));
43218 val_conv.is_owned = (val & 1) || (val == 0);
43219 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43220 val_conv = RawDataPart_clone(&val_conv);
43221 RawInvoice_set_data(&this_ptr_conv, val_conv);
43224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43225 LDKRawInvoice a_conv;
43226 a_conv.inner = (void*)(a & (~1));
43227 a_conv.is_owned = false;
43228 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43229 LDKRawInvoice b_conv;
43230 b_conv.inner = (void*)(b & (~1));
43231 b_conv.is_owned = false;
43232 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43233 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
43237 static inline uintptr_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
43238 LDKRawInvoice ret_var = RawInvoice_clone(arg);
43239 int64_t ret_ref = 0;
43240 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43241 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43242 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43243 ret_ref = (uintptr_t)ret_var.inner;
43244 if (ret_var.is_owned) {
43249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43250 LDKRawInvoice arg_conv;
43251 arg_conv.inner = (void*)(arg & (~1));
43252 arg_conv.is_owned = false;
43253 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43254 int64_t ret_val = RawInvoice_clone_ptr(&arg_conv);
43258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43259 LDKRawInvoice orig_conv;
43260 orig_conv.inner = (void*)(orig & (~1));
43261 orig_conv.is_owned = false;
43262 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43263 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
43264 int64_t ret_ref = 0;
43265 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43266 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43267 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43268 ret_ref = (uintptr_t)ret_var.inner;
43269 if (ret_var.is_owned) {
43275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43276 LDKRawDataPart this_obj_conv;
43277 this_obj_conv.inner = (void*)(this_obj & (~1));
43278 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43279 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43280 RawDataPart_free(this_obj_conv);
43283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
43284 LDKRawDataPart this_ptr_conv;
43285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43286 this_ptr_conv.is_owned = false;
43287 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43288 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
43289 int64_t ret_ref = 0;
43290 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43291 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43292 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43293 ret_ref = (uintptr_t)ret_var.inner;
43294 if (ret_var.is_owned) {
43300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43301 LDKRawDataPart this_ptr_conv;
43302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43303 this_ptr_conv.is_owned = false;
43304 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43305 LDKPositiveTimestamp val_conv;
43306 val_conv.inner = (void*)(val & (~1));
43307 val_conv.is_owned = (val & 1) || (val == 0);
43308 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43309 val_conv = PositiveTimestamp_clone(&val_conv);
43310 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
43313 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43314 LDKRawDataPart a_conv;
43315 a_conv.inner = (void*)(a & (~1));
43316 a_conv.is_owned = false;
43317 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43318 LDKRawDataPart b_conv;
43319 b_conv.inner = (void*)(b & (~1));
43320 b_conv.is_owned = false;
43321 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43322 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
43326 static inline uintptr_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
43327 LDKRawDataPart ret_var = RawDataPart_clone(arg);
43328 int64_t ret_ref = 0;
43329 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43330 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43331 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43332 ret_ref = (uintptr_t)ret_var.inner;
43333 if (ret_var.is_owned) {
43338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43339 LDKRawDataPart arg_conv;
43340 arg_conv.inner = (void*)(arg & (~1));
43341 arg_conv.is_owned = false;
43342 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43343 int64_t ret_val = RawDataPart_clone_ptr(&arg_conv);
43347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43348 LDKRawDataPart orig_conv;
43349 orig_conv.inner = (void*)(orig & (~1));
43350 orig_conv.is_owned = false;
43351 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43352 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
43353 int64_t ret_ref = 0;
43354 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43355 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43356 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43357 ret_ref = (uintptr_t)ret_var.inner;
43358 if (ret_var.is_owned) {
43364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43365 LDKPositiveTimestamp this_obj_conv;
43366 this_obj_conv.inner = (void*)(this_obj & (~1));
43367 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43368 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43369 PositiveTimestamp_free(this_obj_conv);
43372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43373 LDKPositiveTimestamp a_conv;
43374 a_conv.inner = (void*)(a & (~1));
43375 a_conv.is_owned = false;
43376 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43377 LDKPositiveTimestamp b_conv;
43378 b_conv.inner = (void*)(b & (~1));
43379 b_conv.is_owned = false;
43380 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43381 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
43385 static inline uintptr_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
43386 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
43387 int64_t ret_ref = 0;
43388 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43389 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43390 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43391 ret_ref = (uintptr_t)ret_var.inner;
43392 if (ret_var.is_owned) {
43397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43398 LDKPositiveTimestamp arg_conv;
43399 arg_conv.inner = (void*)(arg & (~1));
43400 arg_conv.is_owned = false;
43401 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43402 int64_t ret_val = PositiveTimestamp_clone_ptr(&arg_conv);
43406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43407 LDKPositiveTimestamp orig_conv;
43408 orig_conv.inner = (void*)(orig & (~1));
43409 orig_conv.is_owned = false;
43410 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43411 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
43412 int64_t ret_ref = 0;
43413 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43414 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43415 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43416 ret_ref = (uintptr_t)ret_var.inner;
43417 if (ret_var.is_owned) {
43423 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43424 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
43425 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
43429 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
43430 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
43434 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
43435 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
43439 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
43440 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
43444 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
43445 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
43449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43450 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
43451 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
43452 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
43456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
43457 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
43458 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
43462 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43463 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
43464 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
43468 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
43469 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
43473 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
43474 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
43478 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
43479 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
43483 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
43484 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
43488 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
43489 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
43493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
43494 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
43495 int64_t ret_val = Currency_hash(o_conv);
43499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43500 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
43501 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
43502 jboolean ret_val = Currency_eq(a_conv, b_conv);
43506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43507 LDKSha256 this_obj_conv;
43508 this_obj_conv.inner = (void*)(this_obj & (~1));
43509 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43510 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43511 Sha256_free(this_obj_conv);
43514 static inline uintptr_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
43515 LDKSha256 ret_var = Sha256_clone(arg);
43516 int64_t ret_ref = 0;
43517 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43518 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43519 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43520 ret_ref = (uintptr_t)ret_var.inner;
43521 if (ret_var.is_owned) {
43526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43527 LDKSha256 arg_conv;
43528 arg_conv.inner = (void*)(arg & (~1));
43529 arg_conv.is_owned = false;
43530 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43531 int64_t ret_val = Sha256_clone_ptr(&arg_conv);
43535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43536 LDKSha256 orig_conv;
43537 orig_conv.inner = (void*)(orig & (~1));
43538 orig_conv.is_owned = false;
43539 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43540 LDKSha256 ret_var = Sha256_clone(&orig_conv);
43541 int64_t ret_ref = 0;
43542 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43543 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43544 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43545 ret_ref = (uintptr_t)ret_var.inner;
43546 if (ret_var.is_owned) {
43552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
43554 o_conv.inner = (void*)(o & (~1));
43555 o_conv.is_owned = false;
43556 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43557 int64_t ret_val = Sha256_hash(&o_conv);
43561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43563 a_conv.inner = (void*)(a & (~1));
43564 a_conv.is_owned = false;
43565 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43567 b_conv.inner = (void*)(b & (~1));
43568 b_conv.is_owned = false;
43569 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43570 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
43574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43575 LDKDescription this_obj_conv;
43576 this_obj_conv.inner = (void*)(this_obj & (~1));
43577 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43578 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43579 Description_free(this_obj_conv);
43582 static inline uintptr_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
43583 LDKDescription ret_var = Description_clone(arg);
43584 int64_t ret_ref = 0;
43585 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43586 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43587 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43588 ret_ref = (uintptr_t)ret_var.inner;
43589 if (ret_var.is_owned) {
43594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43595 LDKDescription arg_conv;
43596 arg_conv.inner = (void*)(arg & (~1));
43597 arg_conv.is_owned = false;
43598 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43599 int64_t ret_val = Description_clone_ptr(&arg_conv);
43603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43604 LDKDescription orig_conv;
43605 orig_conv.inner = (void*)(orig & (~1));
43606 orig_conv.is_owned = false;
43607 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43608 LDKDescription ret_var = Description_clone(&orig_conv);
43609 int64_t ret_ref = 0;
43610 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43611 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43612 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43613 ret_ref = (uintptr_t)ret_var.inner;
43614 if (ret_var.is_owned) {
43620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
43621 LDKDescription o_conv;
43622 o_conv.inner = (void*)(o & (~1));
43623 o_conv.is_owned = false;
43624 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43625 int64_t ret_val = Description_hash(&o_conv);
43629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43630 LDKDescription a_conv;
43631 a_conv.inner = (void*)(a & (~1));
43632 a_conv.is_owned = false;
43633 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43634 LDKDescription b_conv;
43635 b_conv.inner = (void*)(b & (~1));
43636 b_conv.is_owned = false;
43637 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43638 jboolean ret_val = Description_eq(&a_conv, &b_conv);
43642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43643 LDKPayeePubKey this_obj_conv;
43644 this_obj_conv.inner = (void*)(this_obj & (~1));
43645 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43646 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43647 PayeePubKey_free(this_obj_conv);
43650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
43651 LDKPayeePubKey this_ptr_conv;
43652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43653 this_ptr_conv.is_owned = false;
43654 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43655 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
43656 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
43660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43661 LDKPayeePubKey this_ptr_conv;
43662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43663 this_ptr_conv.is_owned = false;
43664 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43665 LDKPublicKey val_ref;
43666 CHECK((*env)->GetArrayLength(env, val) == 33);
43667 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
43668 PayeePubKey_set_a(&this_ptr_conv, val_ref);
43671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
43672 LDKPublicKey a_arg_ref;
43673 CHECK((*env)->GetArrayLength(env, a_arg) == 33);
43674 (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
43675 LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
43676 int64_t ret_ref = 0;
43677 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43678 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43679 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43680 ret_ref = (uintptr_t)ret_var.inner;
43681 if (ret_var.is_owned) {
43687 static inline uintptr_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
43688 LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
43689 int64_t ret_ref = 0;
43690 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43691 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43692 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43693 ret_ref = (uintptr_t)ret_var.inner;
43694 if (ret_var.is_owned) {
43699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43700 LDKPayeePubKey arg_conv;
43701 arg_conv.inner = (void*)(arg & (~1));
43702 arg_conv.is_owned = false;
43703 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43704 int64_t ret_val = PayeePubKey_clone_ptr(&arg_conv);
43708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43709 LDKPayeePubKey orig_conv;
43710 orig_conv.inner = (void*)(orig & (~1));
43711 orig_conv.is_owned = false;
43712 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43713 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
43714 int64_t ret_ref = 0;
43715 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43716 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43717 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43718 ret_ref = (uintptr_t)ret_var.inner;
43719 if (ret_var.is_owned) {
43725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
43726 LDKPayeePubKey o_conv;
43727 o_conv.inner = (void*)(o & (~1));
43728 o_conv.is_owned = false;
43729 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43730 int64_t ret_val = PayeePubKey_hash(&o_conv);
43734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43735 LDKPayeePubKey a_conv;
43736 a_conv.inner = (void*)(a & (~1));
43737 a_conv.is_owned = false;
43738 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43739 LDKPayeePubKey b_conv;
43740 b_conv.inner = (void*)(b & (~1));
43741 b_conv.is_owned = false;
43742 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43743 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
43747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43748 LDKExpiryTime this_obj_conv;
43749 this_obj_conv.inner = (void*)(this_obj & (~1));
43750 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43751 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43752 ExpiryTime_free(this_obj_conv);
43755 static inline uintptr_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
43756 LDKExpiryTime ret_var = ExpiryTime_clone(arg);
43757 int64_t ret_ref = 0;
43758 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43759 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43760 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43761 ret_ref = (uintptr_t)ret_var.inner;
43762 if (ret_var.is_owned) {
43767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43768 LDKExpiryTime arg_conv;
43769 arg_conv.inner = (void*)(arg & (~1));
43770 arg_conv.is_owned = false;
43771 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43772 int64_t ret_val = ExpiryTime_clone_ptr(&arg_conv);
43776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43777 LDKExpiryTime orig_conv;
43778 orig_conv.inner = (void*)(orig & (~1));
43779 orig_conv.is_owned = false;
43780 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43781 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
43782 int64_t ret_ref = 0;
43783 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43784 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43785 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43786 ret_ref = (uintptr_t)ret_var.inner;
43787 if (ret_var.is_owned) {
43793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
43794 LDKExpiryTime o_conv;
43795 o_conv.inner = (void*)(o & (~1));
43796 o_conv.is_owned = false;
43797 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43798 int64_t ret_val = ExpiryTime_hash(&o_conv);
43802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43803 LDKExpiryTime a_conv;
43804 a_conv.inner = (void*)(a & (~1));
43805 a_conv.is_owned = false;
43806 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43807 LDKExpiryTime b_conv;
43808 b_conv.inner = (void*)(b & (~1));
43809 b_conv.is_owned = false;
43810 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43811 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
43815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43816 LDKMinFinalCltvExpiry this_obj_conv;
43817 this_obj_conv.inner = (void*)(this_obj & (~1));
43818 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43819 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43820 MinFinalCltvExpiry_free(this_obj_conv);
43823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
43824 LDKMinFinalCltvExpiry this_ptr_conv;
43825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43826 this_ptr_conv.is_owned = false;
43827 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43828 int64_t ret_val = MinFinalCltvExpiry_get_a(&this_ptr_conv);
43832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43833 LDKMinFinalCltvExpiry this_ptr_conv;
43834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
43835 this_ptr_conv.is_owned = false;
43836 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43837 MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
43840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
43841 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
43842 int64_t ret_ref = 0;
43843 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43844 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43845 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43846 ret_ref = (uintptr_t)ret_var.inner;
43847 if (ret_var.is_owned) {
43853 static inline uintptr_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
43854 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
43855 int64_t ret_ref = 0;
43856 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43857 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43858 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43859 ret_ref = (uintptr_t)ret_var.inner;
43860 if (ret_var.is_owned) {
43865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43866 LDKMinFinalCltvExpiry arg_conv;
43867 arg_conv.inner = (void*)(arg & (~1));
43868 arg_conv.is_owned = false;
43869 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43870 int64_t ret_val = MinFinalCltvExpiry_clone_ptr(&arg_conv);
43874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43875 LDKMinFinalCltvExpiry orig_conv;
43876 orig_conv.inner = (void*)(orig & (~1));
43877 orig_conv.is_owned = false;
43878 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43879 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
43880 int64_t ret_ref = 0;
43881 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43882 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
43883 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43884 ret_ref = (uintptr_t)ret_var.inner;
43885 if (ret_var.is_owned) {
43891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
43892 LDKMinFinalCltvExpiry o_conv;
43893 o_conv.inner = (void*)(o & (~1));
43894 o_conv.is_owned = false;
43895 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43896 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
43900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43901 LDKMinFinalCltvExpiry a_conv;
43902 a_conv.inner = (void*)(a & (~1));
43903 a_conv.is_owned = false;
43904 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43905 LDKMinFinalCltvExpiry b_conv;
43906 b_conv.inner = (void*)(b & (~1));
43907 b_conv.is_owned = false;
43908 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43909 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
43913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43914 if ((this_ptr & 1) != 0) return;
43915 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
43916 CHECK_ACCESS(this_ptr_ptr);
43917 LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
43918 FREE((void*)this_ptr);
43919 Fallback_free(this_ptr_conv);
43922 static inline uintptr_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
43923 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
43924 *ret_copy = Fallback_clone(arg);
43925 int64_t ret_ref = (uintptr_t)ret_copy;
43928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43929 LDKFallback* arg_conv = (LDKFallback*)arg;
43930 int64_t ret_val = Fallback_clone_ptr(arg_conv);
43934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43935 LDKFallback* orig_conv = (LDKFallback*)orig;
43936 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
43937 *ret_copy = Fallback_clone(orig_conv);
43938 int64_t ret_ref = (uintptr_t)ret_copy;
43942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
43944 LDKCVec_u8Z program_ref;
43945 program_ref.datalen = (*env)->GetArrayLength(env, program);
43946 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
43947 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
43948 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
43949 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
43950 int64_t ret_ref = (uintptr_t)ret_copy;
43954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
43955 LDKTwentyBytes a_ref;
43956 CHECK((*env)->GetArrayLength(env, a) == 20);
43957 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
43958 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
43959 *ret_copy = Fallback_pub_key_hash(a_ref);
43960 int64_t ret_ref = (uintptr_t)ret_copy;
43964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
43965 LDKTwentyBytes a_ref;
43966 CHECK((*env)->GetArrayLength(env, a) == 20);
43967 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
43968 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
43969 *ret_copy = Fallback_script_hash(a_ref);
43970 int64_t ret_ref = (uintptr_t)ret_copy;
43974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
43975 LDKFallback* o_conv = (LDKFallback*)o;
43976 int64_t ret_val = Fallback_hash(o_conv);
43980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43981 LDKFallback* a_conv = (LDKFallback*)a;
43982 LDKFallback* b_conv = (LDKFallback*)b;
43983 jboolean ret_val = Fallback_eq(a_conv, b_conv);
43987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43988 LDKInvoiceSignature this_obj_conv;
43989 this_obj_conv.inner = (void*)(this_obj & (~1));
43990 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
43991 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43992 InvoiceSignature_free(this_obj_conv);
43995 static inline uintptr_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
43996 LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
43997 int64_t ret_ref = 0;
43998 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
43999 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44000 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44001 ret_ref = (uintptr_t)ret_var.inner;
44002 if (ret_var.is_owned) {
44007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44008 LDKInvoiceSignature arg_conv;
44009 arg_conv.inner = (void*)(arg & (~1));
44010 arg_conv.is_owned = false;
44011 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44012 int64_t ret_val = InvoiceSignature_clone_ptr(&arg_conv);
44016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44017 LDKInvoiceSignature orig_conv;
44018 orig_conv.inner = (void*)(orig & (~1));
44019 orig_conv.is_owned = false;
44020 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44021 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
44022 int64_t ret_ref = 0;
44023 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44024 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44025 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44026 ret_ref = (uintptr_t)ret_var.inner;
44027 if (ret_var.is_owned) {
44033 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44034 LDKInvoiceSignature a_conv;
44035 a_conv.inner = (void*)(a & (~1));
44036 a_conv.is_owned = false;
44037 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44038 LDKInvoiceSignature b_conv;
44039 b_conv.inner = (void*)(b & (~1));
44040 b_conv.is_owned = false;
44041 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44042 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
44046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44047 LDKPrivateRoute this_obj_conv;
44048 this_obj_conv.inner = (void*)(this_obj & (~1));
44049 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44050 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44051 PrivateRoute_free(this_obj_conv);
44054 static inline uintptr_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
44055 LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
44056 int64_t ret_ref = 0;
44057 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44058 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44059 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44060 ret_ref = (uintptr_t)ret_var.inner;
44061 if (ret_var.is_owned) {
44066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44067 LDKPrivateRoute arg_conv;
44068 arg_conv.inner = (void*)(arg & (~1));
44069 arg_conv.is_owned = false;
44070 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44071 int64_t ret_val = PrivateRoute_clone_ptr(&arg_conv);
44075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44076 LDKPrivateRoute orig_conv;
44077 orig_conv.inner = (void*)(orig & (~1));
44078 orig_conv.is_owned = false;
44079 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44080 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
44081 int64_t ret_ref = 0;
44082 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44083 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44084 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44085 ret_ref = (uintptr_t)ret_var.inner;
44086 if (ret_var.is_owned) {
44092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
44093 LDKPrivateRoute o_conv;
44094 o_conv.inner = (void*)(o & (~1));
44095 o_conv.is_owned = false;
44096 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44097 int64_t ret_val = PrivateRoute_hash(&o_conv);
44101 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44102 LDKPrivateRoute a_conv;
44103 a_conv.inner = (void*)(a & (~1));
44104 a_conv.is_owned = false;
44105 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44106 LDKPrivateRoute b_conv;
44107 b_conv.inner = (void*)(b & (~1));
44108 b_conv.is_owned = false;
44109 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44110 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
44114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
44115 LDKSignedRawInvoice this_arg_conv;
44116 this_arg_conv.inner = (void*)(this_arg & (~1));
44117 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44118 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44119 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
44120 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
44121 *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
44122 return ((int64_t)ret_conv);
44125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
44126 LDKSignedRawInvoice this_arg_conv;
44127 this_arg_conv.inner = (void*)(this_arg & (~1));
44128 this_arg_conv.is_owned = false;
44129 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44130 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
44131 int64_t ret_ref = 0;
44132 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44133 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44134 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44135 ret_ref = (uintptr_t)ret_var.inner;
44136 if (ret_var.is_owned) {
44142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44143 LDKSignedRawInvoice this_arg_conv;
44144 this_arg_conv.inner = (void*)(this_arg & (~1));
44145 this_arg_conv.is_owned = false;
44146 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44147 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44148 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
44152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
44153 LDKSignedRawInvoice this_arg_conv;
44154 this_arg_conv.inner = (void*)(this_arg & (~1));
44155 this_arg_conv.is_owned = false;
44156 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44157 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
44158 int64_t ret_ref = 0;
44159 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44160 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44161 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44162 ret_ref = (uintptr_t)ret_var.inner;
44163 if (ret_var.is_owned) {
44169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
44170 LDKSignedRawInvoice this_arg_conv;
44171 this_arg_conv.inner = (void*)(this_arg & (~1));
44172 this_arg_conv.is_owned = false;
44173 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44174 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
44175 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
44176 return (int64_t)ret_conv;
44179 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
44180 LDKSignedRawInvoice this_arg_conv;
44181 this_arg_conv.inner = (void*)(this_arg & (~1));
44182 this_arg_conv.is_owned = false;
44183 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44184 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
44188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44189 LDKRawInvoice this_arg_conv;
44190 this_arg_conv.inner = (void*)(this_arg & (~1));
44191 this_arg_conv.is_owned = false;
44192 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44193 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44194 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
44198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44199 LDKRawInvoice this_arg_conv;
44200 this_arg_conv.inner = (void*)(this_arg & (~1));
44201 this_arg_conv.is_owned = false;
44202 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44203 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
44204 int64_t ret_ref = 0;
44205 if ((uintptr_t)ret_var.inner > 4096) {
44206 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44207 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44208 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44209 ret_ref = (uintptr_t)ret_var.inner;
44210 if (ret_var.is_owned) {
44217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
44218 LDKRawInvoice this_arg_conv;
44219 this_arg_conv.inner = (void*)(this_arg & (~1));
44220 this_arg_conv.is_owned = false;
44221 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44222 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
44223 int64_t ret_ref = 0;
44224 if ((uintptr_t)ret_var.inner > 4096) {
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) {
44236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
44237 LDKRawInvoice this_arg_conv;
44238 this_arg_conv.inner = (void*)(this_arg & (~1));
44239 this_arg_conv.is_owned = false;
44240 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44241 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
44242 int64_t ret_ref = 0;
44243 if ((uintptr_t)ret_var.inner > 4096) {
44244 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44245 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44246 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44247 ret_ref = (uintptr_t)ret_var.inner;
44248 if (ret_var.is_owned) {
44255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44256 LDKRawInvoice this_arg_conv;
44257 this_arg_conv.inner = (void*)(this_arg & (~1));
44258 this_arg_conv.is_owned = false;
44259 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44260 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
44261 int64_t ret_ref = 0;
44262 if ((uintptr_t)ret_var.inner > 4096) {
44263 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44264 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44265 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44266 ret_ref = (uintptr_t)ret_var.inner;
44267 if (ret_var.is_owned) {
44274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
44275 LDKRawInvoice this_arg_conv;
44276 this_arg_conv.inner = (void*)(this_arg & (~1));
44277 this_arg_conv.is_owned = false;
44278 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44279 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
44280 int64_t ret_ref = 0;
44281 if ((uintptr_t)ret_var.inner > 4096) {
44282 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44283 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44284 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44285 ret_ref = (uintptr_t)ret_var.inner;
44286 if (ret_var.is_owned) {
44293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
44294 LDKRawInvoice this_arg_conv;
44295 this_arg_conv.inner = (void*)(this_arg & (~1));
44296 this_arg_conv.is_owned = false;
44297 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44298 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
44299 int64_t ret_ref = 0;
44300 if ((uintptr_t)ret_var.inner > 4096) {
44301 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44302 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44303 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44304 ret_ref = (uintptr_t)ret_var.inner;
44305 if (ret_var.is_owned) {
44312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
44313 LDKRawInvoice this_arg_conv;
44314 this_arg_conv.inner = (void*)(this_arg & (~1));
44315 this_arg_conv.is_owned = false;
44316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44317 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44318 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
44322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44323 LDKRawInvoice this_arg_conv;
44324 this_arg_conv.inner = (void*)(this_arg & (~1));
44325 this_arg_conv.is_owned = false;
44326 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44327 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
44328 int64_t ret_ref = 0;
44329 if ((uintptr_t)ret_var.inner > 4096) {
44330 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44331 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44332 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44333 ret_ref = (uintptr_t)ret_var.inner;
44334 if (ret_var.is_owned) {
44341 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
44342 LDKRawInvoice this_arg_conv;
44343 this_arg_conv.inner = (void*)(this_arg & (~1));
44344 this_arg_conv.is_owned = false;
44345 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44346 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
44347 int64_tArray ret_arr = NULL;
44348 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44349 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44350 for (size_t o = 0; o < ret_var.datalen; o++) {
44351 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
44352 int64_t ret_conv_14_ref = 0;
44353 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44354 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44355 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44356 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
44357 if (ret_conv_14_var.is_owned) {
44358 ret_conv_14_ref |= 1;
44360 ret_arr_ptr[o] = ret_conv_14_ref;
44362 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44363 FREE(ret_var.data);
44367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
44368 LDKRawInvoice this_arg_conv;
44369 this_arg_conv.inner = (void*)(this_arg & (~1));
44370 this_arg_conv.is_owned = false;
44371 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44372 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44373 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
44374 int64_t ret_ref = (uintptr_t)ret_copy;
44378 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
44379 LDKRawInvoice this_arg_conv;
44380 this_arg_conv.inner = (void*)(this_arg & (~1));
44381 this_arg_conv.is_owned = false;
44382 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44383 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
44387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
44388 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
44389 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
44390 return (int64_t)ret_conv;
44393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
44394 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
44395 *ret_conv = PositiveTimestamp_from_system_time(time);
44396 return (int64_t)ret_conv;
44399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
44400 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
44401 *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
44402 return (int64_t)ret_conv;
44405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
44406 LDKPositiveTimestamp this_arg_conv;
44407 this_arg_conv.inner = (void*)(this_arg & (~1));
44408 this_arg_conv.is_owned = false;
44409 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44410 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
44414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
44415 LDKPositiveTimestamp this_arg_conv;
44416 this_arg_conv.inner = (void*)(this_arg & (~1));
44417 this_arg_conv.is_owned = false;
44418 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44419 int64_t ret_val = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
44423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
44424 LDKPositiveTimestamp this_arg_conv;
44425 this_arg_conv.inner = (void*)(this_arg & (~1));
44426 this_arg_conv.is_owned = false;
44427 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44428 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
44432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
44433 LDKInvoice this_arg_conv;
44434 this_arg_conv.inner = (void*)(this_arg & (~1));
44435 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44436 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44437 this_arg_conv = Invoice_clone(&this_arg_conv);
44438 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
44439 int64_t ret_ref = 0;
44440 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44441 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44442 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44443 ret_ref = (uintptr_t)ret_var.inner;
44444 if (ret_var.is_owned) {
44450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
44451 LDKInvoice this_arg_conv;
44452 this_arg_conv.inner = (void*)(this_arg & (~1));
44453 this_arg_conv.is_owned = false;
44454 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44455 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
44456 *ret_conv = Invoice_check_signature(&this_arg_conv);
44457 return (int64_t)ret_conv;
44460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
44461 LDKSignedRawInvoice signed_invoice_conv;
44462 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
44463 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
44464 CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
44465 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
44466 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
44467 *ret_conv = Invoice_from_signed(signed_invoice_conv);
44468 return (int64_t)ret_conv;
44471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
44472 LDKInvoice this_arg_conv;
44473 this_arg_conv.inner = (void*)(this_arg & (~1));
44474 this_arg_conv.is_owned = false;
44475 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44476 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
44480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
44481 LDKInvoice this_arg_conv;
44482 this_arg_conv.inner = (void*)(this_arg & (~1));
44483 this_arg_conv.is_owned = false;
44484 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44485 int64_t ret_val = Invoice_duration_since_epoch(&this_arg_conv);
44489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
44490 LDKInvoice this_arg_conv;
44491 this_arg_conv.inner = (void*)(this_arg & (~1));
44492 this_arg_conv.is_owned = false;
44493 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44494 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44495 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
44499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
44500 LDKInvoice this_arg_conv;
44501 this_arg_conv.inner = (void*)(this_arg & (~1));
44502 this_arg_conv.is_owned = false;
44503 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44504 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44505 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
44509 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
44510 LDKInvoice this_arg_conv;
44511 this_arg_conv.inner = (void*)(this_arg & (~1));
44512 this_arg_conv.is_owned = false;
44513 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44514 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
44515 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_secret(&this_arg_conv));
44519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
44520 LDKInvoice this_arg_conv;
44521 this_arg_conv.inner = (void*)(this_arg & (~1));
44522 this_arg_conv.is_owned = false;
44523 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44524 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
44525 int64_t ret_ref = 0;
44526 if ((uintptr_t)ret_var.inner > 4096) {
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) {
44538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
44539 LDKInvoice this_arg_conv;
44540 this_arg_conv.inner = (void*)(this_arg & (~1));
44541 this_arg_conv.is_owned = false;
44542 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44543 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
44544 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
44548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
44549 LDKInvoice this_arg_conv;
44550 this_arg_conv.inner = (void*)(this_arg & (~1));
44551 this_arg_conv.is_owned = false;
44552 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44553 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
44557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
44558 LDKInvoice this_arg_conv;
44559 this_arg_conv.inner = (void*)(this_arg & (~1));
44560 this_arg_conv.is_owned = false;
44561 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44562 jboolean ret_val = Invoice_is_expired(&this_arg_conv);
44566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
44567 LDKInvoice this_arg_conv;
44568 this_arg_conv.inner = (void*)(this_arg & (~1));
44569 this_arg_conv.is_owned = false;
44570 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44571 jboolean ret_val = Invoice_would_expire(&this_arg_conv, at_time);
44575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
44576 LDKInvoice this_arg_conv;
44577 this_arg_conv.inner = (void*)(this_arg & (~1));
44578 this_arg_conv.is_owned = false;
44579 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44580 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
44584 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
44585 LDKInvoice this_arg_conv;
44586 this_arg_conv.inner = (void*)(this_arg & (~1));
44587 this_arg_conv.is_owned = false;
44588 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44589 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
44590 int64_tArray ret_arr = NULL;
44591 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44592 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44593 for (size_t o = 0; o < ret_var.datalen; o++) {
44594 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
44595 int64_t ret_conv_14_ref = 0;
44596 CHECK((((uintptr_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44597 CHECK((((uintptr_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44598 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44599 ret_conv_14_ref = (uintptr_t)ret_conv_14_var.inner;
44600 if (ret_conv_14_var.is_owned) {
44601 ret_conv_14_ref |= 1;
44603 ret_arr_ptr[o] = ret_conv_14_ref;
44605 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44606 FREE(ret_var.data);
44610 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
44611 LDKInvoice this_arg_conv;
44612 this_arg_conv.inner = (void*)(this_arg & (~1));
44613 this_arg_conv.is_owned = false;
44614 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44615 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
44616 int64_tArray ret_arr = NULL;
44617 ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44618 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44619 for (size_t l = 0; l < ret_var.datalen; l++) {
44620 LDKRouteHint ret_conv_11_var = ret_var.data[l];
44621 int64_t ret_conv_11_ref = 0;
44622 CHECK((((uintptr_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44623 CHECK((((uintptr_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44624 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
44625 ret_conv_11_ref = (uintptr_t)ret_conv_11_var.inner;
44626 if (ret_conv_11_var.is_owned) {
44627 ret_conv_11_ref |= 1;
44629 ret_arr_ptr[l] = ret_conv_11_ref;
44631 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44632 FREE(ret_var.data);
44636 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
44637 LDKInvoice this_arg_conv;
44638 this_arg_conv.inner = (void*)(this_arg & (~1));
44639 this_arg_conv.is_owned = false;
44640 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44641 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
44645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
44646 LDKInvoice this_arg_conv;
44647 this_arg_conv.inner = (void*)(this_arg & (~1));
44648 this_arg_conv.is_owned = false;
44649 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44650 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44651 *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
44652 int64_t ret_ref = (uintptr_t)ret_copy;
44656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
44657 LDKStr description_conv = java_to_owned_str(env, description);
44658 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
44659 *ret_conv = Description_new(description_conv);
44660 return (int64_t)ret_conv;
44663 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
44664 LDKDescription this_arg_conv;
44665 this_arg_conv.inner = (void*)(this_arg & (~1));
44666 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44667 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44668 this_arg_conv = Description_clone(&this_arg_conv);
44669 LDKStr ret_str = Description_into_inner(this_arg_conv);
44670 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
44675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
44676 LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
44677 int64_t ret_ref = 0;
44678 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44679 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44680 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44681 ret_ref = (uintptr_t)ret_var.inner;
44682 if (ret_var.is_owned) {
44688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
44689 LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
44690 int64_t ret_ref = 0;
44691 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44692 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44693 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44694 ret_ref = (uintptr_t)ret_var.inner;
44695 if (ret_var.is_owned) {
44701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
44702 LDKExpiryTime this_arg_conv;
44703 this_arg_conv.inner = (void*)(this_arg & (~1));
44704 this_arg_conv.is_owned = false;
44705 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44706 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
44710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
44711 LDKExpiryTime this_arg_conv;
44712 this_arg_conv.inner = (void*)(this_arg & (~1));
44713 this_arg_conv.is_owned = false;
44714 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44715 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
44719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
44720 LDKRouteHint hops_conv;
44721 hops_conv.inner = (void*)(hops & (~1));
44722 hops_conv.is_owned = (hops & 1) || (hops == 0);
44723 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
44724 hops_conv = RouteHint_clone(&hops_conv);
44725 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
44726 *ret_conv = PrivateRoute_new(hops_conv);
44727 return (int64_t)ret_conv;
44730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
44731 LDKPrivateRoute this_arg_conv;
44732 this_arg_conv.inner = (void*)(this_arg & (~1));
44733 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
44734 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44735 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
44736 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
44737 int64_t ret_ref = 0;
44738 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44739 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44740 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44741 ret_ref = (uintptr_t)ret_var.inner;
44742 if (ret_var.is_owned) {
44748 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44749 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
44750 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
44754 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
44755 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
44759 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
44760 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
44764 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
44765 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
44769 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
44770 jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
44774 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
44775 jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
44779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44780 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
44781 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
44782 jboolean ret_val = CreationError_eq(a_conv, b_conv);
44786 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
44787 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
44788 LDKStr ret_str = CreationError_to_str(o_conv);
44789 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
44794 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44795 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
44796 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
44800 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
44801 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
44805 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
44806 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
44810 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
44811 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
44815 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
44816 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
44820 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
44821 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
44825 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
44826 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
44830 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
44831 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
44835 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
44836 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
44840 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
44841 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
44845 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
44846 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
44850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44851 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
44852 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
44853 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
44857 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
44858 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
44859 LDKStr ret_str = SemanticError_to_str(o_conv);
44860 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
44865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44866 if ((this_ptr & 1) != 0) return;
44867 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44868 CHECK_ACCESS(this_ptr_ptr);
44869 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
44870 FREE((void*)this_ptr);
44871 SignOrCreationError_free(this_ptr_conv);
44874 static inline uintptr_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
44875 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
44876 *ret_copy = SignOrCreationError_clone(arg);
44877 int64_t ret_ref = (uintptr_t)ret_copy;
44880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44881 LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)arg;
44882 int64_t ret_val = SignOrCreationError_clone_ptr(arg_conv);
44886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44887 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
44888 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
44889 *ret_copy = SignOrCreationError_clone(orig_conv);
44890 int64_t ret_ref = (uintptr_t)ret_copy;
44894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
44895 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
44896 *ret_copy = SignOrCreationError_sign_error();
44897 int64_t ret_ref = (uintptr_t)ret_copy;
44901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
44902 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
44903 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
44904 *ret_copy = SignOrCreationError_creation_error(a_conv);
44905 int64_t ret_ref = (uintptr_t)ret_copy;
44909 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44910 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
44911 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
44912 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
44916 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
44917 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
44918 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
44919 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
44924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44925 LDKInvoicePayer this_obj_conv;
44926 this_obj_conv.inner = (void*)(this_obj & (~1));
44927 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44928 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44929 InvoicePayer_free(this_obj_conv);
44932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44933 if ((this_ptr & 1) != 0) return;
44934 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44935 CHECK_ACCESS(this_ptr_ptr);
44936 LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
44937 FREE((void*)this_ptr);
44938 Payer_free(this_ptr_conv);
44941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44942 if ((this_ptr & 1) != 0) return;
44943 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
44944 CHECK_ACCESS(this_ptr_ptr);
44945 LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
44946 FREE((void*)this_ptr);
44947 Router_free(this_ptr_conv);
44950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44951 LDKRetryAttempts this_obj_conv;
44952 this_obj_conv.inner = (void*)(this_obj & (~1));
44953 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
44954 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44955 RetryAttempts_free(this_obj_conv);
44958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
44959 LDKRetryAttempts this_ptr_conv;
44960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44961 this_ptr_conv.is_owned = false;
44962 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44963 int64_t ret_val = RetryAttempts_get_a(&this_ptr_conv);
44967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44968 LDKRetryAttempts this_ptr_conv;
44969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
44970 this_ptr_conv.is_owned = false;
44971 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44972 RetryAttempts_set_a(&this_ptr_conv, val);
44975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
44976 LDKRetryAttempts ret_var = RetryAttempts_new(a_arg);
44977 int64_t ret_ref = 0;
44978 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44979 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44980 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44981 ret_ref = (uintptr_t)ret_var.inner;
44982 if (ret_var.is_owned) {
44988 static inline uintptr_t RetryAttempts_clone_ptr(LDKRetryAttempts *NONNULL_PTR arg) {
44989 LDKRetryAttempts ret_var = RetryAttempts_clone(arg);
44990 int64_t ret_ref = 0;
44991 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
44992 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
44993 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44994 ret_ref = (uintptr_t)ret_var.inner;
44995 if (ret_var.is_owned) {
45000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45001 LDKRetryAttempts arg_conv;
45002 arg_conv.inner = (void*)(arg & (~1));
45003 arg_conv.is_owned = false;
45004 CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45005 int64_t ret_val = RetryAttempts_clone_ptr(&arg_conv);
45009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45010 LDKRetryAttempts orig_conv;
45011 orig_conv.inner = (void*)(orig & (~1));
45012 orig_conv.is_owned = false;
45013 CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45014 LDKRetryAttempts ret_var = RetryAttempts_clone(&orig_conv);
45015 int64_t ret_ref = 0;
45016 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45017 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45018 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45019 ret_ref = (uintptr_t)ret_var.inner;
45020 if (ret_var.is_owned) {
45026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45027 LDKRetryAttempts a_conv;
45028 a_conv.inner = (void*)(a & (~1));
45029 a_conv.is_owned = false;
45030 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45031 LDKRetryAttempts b_conv;
45032 b_conv.inner = (void*)(b & (~1));
45033 b_conv.is_owned = false;
45034 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45035 jboolean ret_val = RetryAttempts_eq(&a_conv, &b_conv);
45039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RetryAttempts_1hash(JNIEnv *env, jclass clz, int64_t o) {
45040 LDKRetryAttempts o_conv;
45041 o_conv.inner = (void*)(o & (~1));
45042 o_conv.is_owned = false;
45043 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45044 int64_t ret_val = RetryAttempts_hash(&o_conv);
45048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45049 if ((this_ptr & 1) != 0) return;
45050 void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1);
45051 CHECK_ACCESS(this_ptr_ptr);
45052 LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
45053 FREE((void*)this_ptr);
45054 PaymentError_free(this_ptr_conv);
45057 static inline uintptr_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
45058 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45059 *ret_copy = PaymentError_clone(arg);
45060 int64_t ret_ref = (uintptr_t)ret_copy;
45063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45064 LDKPaymentError* arg_conv = (LDKPaymentError*)arg;
45065 int64_t ret_val = PaymentError_clone_ptr(arg_conv);
45069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45070 LDKPaymentError* orig_conv = (LDKPaymentError*)orig;
45071 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45072 *ret_copy = PaymentError_clone(orig_conv);
45073 int64_t ret_ref = (uintptr_t)ret_copy;
45077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1invoice(JNIEnv *env, jclass clz, jstring a) {
45078 LDKStr a_conv = java_to_owned_str(env, a);
45079 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45080 *ret_copy = PaymentError_invoice(a_conv);
45081 int64_t ret_ref = (uintptr_t)ret_copy;
45085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1routing(JNIEnv *env, jclass clz, int64_t a) {
45086 LDKLightningError a_conv;
45087 a_conv.inner = (void*)(a & (~1));
45088 a_conv.is_owned = (a & 1) || (a == 0);
45089 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45090 a_conv = LightningError_clone(&a_conv);
45091 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45092 *ret_copy = PaymentError_routing(a_conv);
45093 int64_t ret_ref = (uintptr_t)ret_copy;
45097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentError_1sending(JNIEnv *env, jclass clz, int64_t a) {
45098 void* a_ptr = (void*)(((uintptr_t)a) & ~1);
45099 CHECK_ACCESS(a_ptr);
45100 LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
45101 a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uintptr_t)a) & ~1));
45102 LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45103 *ret_copy = PaymentError_sending(a_conv);
45104 int64_t ret_ref = (uintptr_t)ret_copy;
45108 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) {
45109 void* payer_ptr = (void*)(((uintptr_t)payer) & ~1);
45110 CHECK_ACCESS(payer_ptr);
45111 LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
45112 if (payer_conv.free == LDKPayer_JCalls_free) {
45113 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45114 LDKPayer_JCalls_cloned(&payer_conv);
45116 void* router_ptr = (void*)(((uintptr_t)router) & ~1);
45117 CHECK_ACCESS(router_ptr);
45118 LDKRouter router_conv = *(LDKRouter*)(router_ptr);
45119 if (router_conv.free == LDKRouter_JCalls_free) {
45120 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45121 LDKRouter_JCalls_cloned(&router_conv);
45123 LDKMultiThreadedLockableScore scorer_conv;
45124 scorer_conv.inner = (void*)(scorer & (~1));
45125 scorer_conv.is_owned = false;
45126 CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv);
45127 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45128 CHECK_ACCESS(logger_ptr);
45129 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45130 if (logger_conv.free == LDKLogger_JCalls_free) {
45131 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45132 LDKLogger_JCalls_cloned(&logger_conv);
45134 void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1);
45135 CHECK_ACCESS(event_handler_ptr);
45136 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
45137 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
45138 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45139 LDKEventHandler_JCalls_cloned(&event_handler_conv);
45141 LDKRetryAttempts retry_attempts_conv;
45142 retry_attempts_conv.inner = (void*)(retry_attempts & (~1));
45143 retry_attempts_conv.is_owned = (retry_attempts & 1) || (retry_attempts == 0);
45144 CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_attempts_conv);
45145 retry_attempts_conv = RetryAttempts_clone(&retry_attempts_conv);
45146 LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, &scorer_conv, logger_conv, event_handler_conv, retry_attempts_conv);
45147 int64_t ret_ref = 0;
45148 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45149 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45150 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45151 ret_ref = (uintptr_t)ret_var.inner;
45152 if (ret_var.is_owned) {
45158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
45159 LDKInvoicePayer this_arg_conv;
45160 this_arg_conv.inner = (void*)(this_arg & (~1));
45161 this_arg_conv.is_owned = false;
45162 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45163 LDKInvoice invoice_conv;
45164 invoice_conv.inner = (void*)(invoice & (~1));
45165 invoice_conv.is_owned = false;
45166 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45167 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45168 *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
45169 return (int64_t)ret_conv;
45172 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) {
45173 LDKInvoicePayer this_arg_conv;
45174 this_arg_conv.inner = (void*)(this_arg & (~1));
45175 this_arg_conv.is_owned = false;
45176 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45177 LDKInvoice invoice_conv;
45178 invoice_conv.inner = (void*)(invoice & (~1));
45179 invoice_conv.is_owned = false;
45180 CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45181 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45182 *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
45183 return (int64_t)ret_conv;
45186 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) {
45187 LDKInvoicePayer this_arg_conv;
45188 this_arg_conv.inner = (void*)(this_arg & (~1));
45189 this_arg_conv.is_owned = false;
45190 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45191 LDKPublicKey pubkey_ref;
45192 CHECK((*env)->GetArrayLength(env, pubkey) == 33);
45193 (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
45194 LDKThirtyTwoBytes payment_preimage_ref;
45195 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
45196 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
45197 LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45198 *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
45199 return (int64_t)ret_conv;
45202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
45203 LDKInvoicePayer this_arg_conv;
45204 this_arg_conv.inner = (void*)(this_arg & (~1));
45205 this_arg_conv.is_owned = false;
45206 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45207 unsigned char payment_hash_arr[32];
45208 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
45209 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
45210 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
45211 InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
45214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
45215 LDKInvoicePayer this_arg_conv;
45216 this_arg_conv.inner = (void*)(this_arg & (~1));
45217 this_arg_conv.is_owned = false;
45218 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45219 LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
45220 *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
45221 return (int64_t)ret_ret;
45224 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) {
45225 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
45226 CHECK_ACCESS(amt_msat_ptr);
45227 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
45228 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
45229 LDKStr description_conv = java_to_owned_str(env, description);
45230 LDKThirtyTwoBytes payment_hash_ref;
45231 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
45232 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
45233 LDKThirtyTwoBytes payment_secret_ref;
45234 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
45235 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
45236 LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
45237 phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
45238 if (phantom_route_hints_constr.datalen > 0)
45239 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
45241 phantom_route_hints_constr.data = NULL;
45242 int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
45243 for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
45244 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
45245 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
45246 phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1));
45247 phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0);
45248 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
45249 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
45250 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
45252 (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
45253 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
45254 CHECK_ACCESS(keys_manager_ptr);
45255 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45256 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45257 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45258 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45260 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
45261 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
45262 *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);
45263 return (int64_t)ret_conv;
45266 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) {
45267 LDKChannelManager channelmanager_conv;
45268 channelmanager_conv.inner = (void*)(channelmanager & (~1));
45269 channelmanager_conv.is_owned = false;
45270 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
45271 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
45272 CHECK_ACCESS(keys_manager_ptr);
45273 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45274 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45275 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45276 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45278 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
45279 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
45280 CHECK_ACCESS(amt_msat_ptr);
45281 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
45282 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
45283 LDKStr description_conv = java_to_owned_str(env, description);
45284 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
45285 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
45286 return (int64_t)ret_conv;
45289 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) {
45290 LDKChannelManager channelmanager_conv;
45291 channelmanager_conv.inner = (void*)(channelmanager & (~1));
45292 channelmanager_conv.is_owned = false;
45293 CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
45294 void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1);
45295 CHECK_ACCESS(keys_manager_ptr);
45296 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
45297 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
45298 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45299 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
45301 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
45302 void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1);
45303 CHECK_ACCESS(amt_msat_ptr);
45304 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
45305 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1));
45306 LDKStr description_conv = java_to_owned_str(env, description);
45307 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
45308 *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);
45309 return (int64_t)ret_conv;
45312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45313 LDKDefaultRouter this_obj_conv;
45314 this_obj_conv.inner = (void*)(this_obj & (~1));
45315 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
45316 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45317 DefaultRouter_free(this_obj_conv);
45320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
45321 LDKNetworkGraph network_graph_conv;
45322 network_graph_conv.inner = (void*)(network_graph & (~1));
45323 network_graph_conv.is_owned = false;
45324 CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45325 void* logger_ptr = (void*)(((uintptr_t)logger) & ~1);
45326 CHECK_ACCESS(logger_ptr);
45327 LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45328 if (logger_conv.free == LDKLogger_JCalls_free) {
45329 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45330 LDKLogger_JCalls_cloned(&logger_conv);
45332 LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv);
45333 int64_t ret_ref = 0;
45334 CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
45335 CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
45336 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45337 ret_ref = (uintptr_t)ret_var.inner;
45338 if (ret_var.is_owned) {
45344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
45345 LDKDefaultRouter this_arg_conv;
45346 this_arg_conv.inner = (void*)(this_arg & (~1));
45347 this_arg_conv.is_owned = false;
45348 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45349 LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
45350 *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
45351 return (int64_t)ret_ret;
45354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(JNIEnv *env, jclass clz, int64_t this_arg) {
45355 LDKChannelManager this_arg_conv;
45356 this_arg_conv.inner = (void*)(this_arg & (~1));
45357 this_arg_conv.is_owned = false;
45358 CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45359 LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
45360 *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
45361 return (int64_t)ret_ret;
45364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
45365 LDKStr s_conv = java_to_owned_str(env, s);
45366 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
45367 *ret_conv = SiPrefix_from_str(s_conv);
45368 return (int64_t)ret_conv;
45371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
45372 LDKStr s_conv = java_to_owned_str(env, s);
45373 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
45374 *ret_conv = Invoice_from_str(s_conv);
45375 return (int64_t)ret_conv;
45378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
45379 LDKStr s_conv = java_to_owned_str(env, s);
45380 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
45381 *ret_conv = SignedRawInvoice_from_str(s_conv);
45382 return (int64_t)ret_conv;
45385 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45387 o_conv.inner = (void*)(o & (~1));
45388 o_conv.is_owned = false;
45389 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45390 LDKStr ret_str = Invoice_to_str(&o_conv);
45391 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45396 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45397 LDKSignedRawInvoice o_conv;
45398 o_conv.inner = (void*)(o & (~1));
45399 o_conv.is_owned = false;
45400 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45401 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
45402 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45407 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45408 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
45409 LDKStr ret_str = Currency_to_str(o_conv);
45410 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45415 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
45416 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
45417 LDKStr ret_str = SiPrefix_to_str(o_conv);
45418 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);